From 7b7a45cdf4a1cadf41998fc52e686b7c9dc3fe26 Mon Sep 17 00:00:00 2001 From: PhilReact Date: Tue, 1 Apr 2025 02:54:28 +0300 Subject: [PATCH] fix going back to public node --- src/App.tsx | 4 ++-- src/background.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 1713985..596377c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -263,7 +263,7 @@ export const getBaseApiReact = (customApi?: string) => { return customApi; } - if (globalApiKey) { + if (globalApiKey?.url) { return globalApiKey?.url; } else { return groupApi; @@ -289,7 +289,7 @@ export const getBaseApiReactSocket = (customApi?: string) => { return customApi; } - if (globalApiKey) { + if (globalApiKey?.url) { return `${getProtocol(globalApiKey?.url) === 'http' ? 'ws://': 'wss://'}${cleanUrl(globalApiKey?.url)}` } else { return groupApiSocket; diff --git a/src/background.ts b/src/background.ts index c1cde37..543960a 100644 --- a/src/background.ts +++ b/src/background.ts @@ -178,7 +178,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; @@ -187,7 +187,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; @@ -204,7 +204,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}`;