export class Xhr { baseUrl: string; baseHeaders: any; constructor(baseUrl: string, baseHeaders?: any) { this.baseUrl = baseUrl; this.baseHeaders = baseHeaders ?? {}; } async request( method: 'GET' | 'POST', url: string, options?: { body?: any } ): Promise { return fetch(this.baseUrl + url, { method: method, headers: { Accept: 'application/json', 'Content-Type': 'application/json', ...this.baseHeaders, }, ...(options?.body ? { body: JSON.stringify(options.body) } : {}), }).then((response) => response.json()); } }