From 341f610159acd72ebf0bcd6abc2004da819ad94f Mon Sep 17 00:00:00 2001 From: Qing Date: Sat, 23 Nov 2024 20:04:03 +0800 Subject: [PATCH] make typescript happy --- web_app/src/lib/api.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/web_app/src/lib/api.ts b/web_app/src/lib/api.ts index e35ccce..62eb36e 100644 --- a/web_app/src/lib/api.ts +++ b/web_app/src/lib/api.ts @@ -18,7 +18,7 @@ const api = axios.create({ baseURL: API_ENDPOINT, }) -const throwErrors = async (res: any) => { +const throwErrors = async (res: any): Promise => { const errMsg = await res.json() throw new Error( `${errMsg.errors}\nPlease take a screenshot of the detailed error message in your terminal` @@ -99,7 +99,7 @@ export default async function inpaint( seed: res.headers.get("X-Seed"), } } - await throwErrors(res) + throw await throwErrors(res) } export async function getServerConfig(): Promise { @@ -149,7 +149,7 @@ export async function runPlugin( const blob = await res.blob() return { blob: URL.createObjectURL(blob) } } - await throwErrors(res) + throw await throwErrors(res) } export async function getMediaFile(tab: string, filename: string) { @@ -168,7 +168,7 @@ export async function getMediaFile(tab: string, filename: string) { }) return file } - await throwErrors(res) + throw await throwErrors(res) } export async function getMediaBlob(tab: string, filename: string) { @@ -184,7 +184,7 @@ export async function getMediaBlob(tab: string, filename: string) { const blob = await res.blob() return blob } - await throwErrors(res) + throw await throwErrors(res) } export async function getMedias(tab: string): Promise { @@ -207,7 +207,7 @@ export async function downloadToOutput( body: fd, }) if (!res.ok) { - await throwErrors(res) + throw await throwErrors(res) } } catch (error) { throw new Error(`Something went wrong: ${error}`) @@ -247,5 +247,5 @@ export async function postAdjustMask( const blob = await res.blob() return blob } - throwErrors(res) + throw await throwErrors(res) }