mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-28 02:26:10 +00:00
web/lib/api: return errors from authorization function
This commit is contained in:
parent
6bb412852d
commit
d8f3bbe0f3
|
@ -41,8 +41,6 @@ const getAuthorization = async () => {
|
||||||
if (processing.enableCustomApiKey && processing.customApiKey.length > 0) {
|
if (processing.enableCustomApiKey && processing.customApiKey.length > 0) {
|
||||||
return `Api-Key ${processing.customApiKey}`;
|
return `Api-Key ${processing.customApiKey}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const request = async (url: string) => {
|
const request = async (url: string) => {
|
||||||
|
@ -86,7 +84,11 @@ const request = async (url: string) => {
|
||||||
const api = currentApiURL();
|
const api = currentApiURL();
|
||||||
const authorization = await getAuthorization();
|
const authorization = await getAuthorization();
|
||||||
|
|
||||||
let extraHeaders = {}
|
if (authorization && typeof authorization !== "string") {
|
||||||
|
return authorization;
|
||||||
|
}
|
||||||
|
|
||||||
|
let extraHeaders = {};
|
||||||
|
|
||||||
if (authorization) {
|
if (authorization) {
|
||||||
extraHeaders = {
|
extraHeaders = {
|
||||||
|
|
Loading…
Reference in a new issue