diff --git a/src/App.tsx b/src/App.tsx index 1fc5acb..67b1764 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -347,7 +347,7 @@ export const getBaseApiReact = (customApi?: string) => { return customApi; } - if (globalApiKey) { + if (globalApiKey?.url) { return globalApiKey?.url; } else { return groupApi; @@ -373,7 +373,7 @@ export const getBaseApiReactSocket = (customApi?: string) => { return customApi; } - if (globalApiKey) { + if (globalApiKey?.url) { return `${ getProtocol(globalApiKey?.url) === "http" ? "ws://" : "wss://" }${cleanUrl(globalApiKey?.url)}`; diff --git a/src/background.ts b/src/background.ts index 0f27c81..5534aa1 100644 --- a/src/background.ts +++ b/src/background.ts @@ -272,7 +272,7 @@ export const getBaseApi = async (customApi?: string) => { } const apiKey = await getApiKeyFromStorage(); // Retrieve apiKey asynchronously - if (apiKey) { + if (apiKey?.url) { return apiKey?.url; } else { return groupApi; @@ -280,7 +280,7 @@ export const getBaseApi = async (customApi?: string) => { }; export const isUsingLocal = async () => { const apiKey = await getApiKeyFromStorage(); // Retrieve apiKey asynchronously - if (apiKey) { + if (apiKey?.url) { return true; } else { return false; @@ -294,7 +294,7 @@ export const createEndpoint = async (endpoint, customApi?: string) => { const apiKey = await getApiKeyFromStorage(); // Retrieve apiKey asynchronously - if (apiKey) { + if (apiKey?.url) { // Check if the endpoint already contains a query string const separator = endpoint.includes("?") ? "&" : "?"; return `${apiKey?.url}${endpoint}${separator}apiKey=${apiKey?.apikey}`;