From d8f3bbe0f3b81a25ea2f3b476056384bfddb3f8c Mon Sep 17 00:00:00 2001 From: wukko Date: Sun, 24 Nov 2024 13:37:36 +0600 Subject: [PATCH] web/lib/api: return errors from authorization function --- web/src/lib/api/api.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/src/lib/api/api.ts b/web/src/lib/api/api.ts index d8424a00..89fba727 100644 --- a/web/src/lib/api/api.ts +++ b/web/src/lib/api/api.ts @@ -41,8 +41,6 @@ const getAuthorization = async () => { if (processing.enableCustomApiKey && processing.customApiKey.length > 0) { return `Api-Key ${processing.customApiKey}`; } - - return false; } const request = async (url: string) => { @@ -86,7 +84,11 @@ const request = async (url: string) => { const api = currentApiURL(); const authorization = await getAuthorization(); - let extraHeaders = {} + if (authorization && typeof authorization !== "string") { + return authorization; + } + + let extraHeaders = {}; if (authorization) { extraHeaders = {