Skip to content

best way to save what you love

web/lib/api: return errors from authorization function

wukkod8f3bbe0f3b8
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 = {