From b6abc3608aa54d0deac38b10fbe54ef9435e8759 Mon Sep 17 00:00:00 2001 From: FineArchs <133759614+FineArchs@users.noreply.github.com> Date: Fri, 8 Dec 2023 05:23:52 +0900 Subject: [PATCH] Update api.ts --- packages/frontend/src/scripts/api.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 => {