class Api { baseUrl: string; api: Api; constructor(baseUrl: string) { this.baseUrl = baseUrl; } getUrl = (path: string) => `${this.baseUrl}${path}`; getUserInfo = async (code: string) => await (await fetch(this.getUrl(`/getUserInfo?code=${code}`))).json(); } export const api = new Api("http://10.1.121.166:8000");