diff --git a/packages/frontend/src/scripts/api.ts b/packages/frontend/src/scripts/api.ts index b7a681095f..35b4acab46 100644 --- a/packages/frontend/src/scripts/api.ts +++ b/packages/frontend/src/scripts/api.ts @@ -56,13 +56,12 @@ export function api( - hostUrl: string, +export async function apiExternal( + host: string, endpoint: E, data: P = {} as any, token?: string | null | undefined, signal?: AbortSignal, ): Promise> { - if (!/^https?:\/\//.test(hostUrl)) throw new Error('invalid host name'); if (endpoint.includes('://')) throw new Error('invalid endpoint'); const [hostName, hostUrl] = await (new Promise(resolve => resolve(URL(host)))) .then(url => {