mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-04-20 02:05:52 +00:00
fix going back to public node
This commit is contained in:
parent
69f33733df
commit
12dc1a91fd
@ -290,7 +290,7 @@ export const getBaseApiReact = (customApi?: string) => {
|
||||
return customApi;
|
||||
}
|
||||
|
||||
if (globalApiKey) {
|
||||
if (globalApiKey?.url) {
|
||||
return globalApiKey?.url;
|
||||
} else {
|
||||
return groupApi;
|
||||
@ -316,7 +316,7 @@ export const getBaseApiReactSocket = (customApi?: string) => {
|
||||
return customApi;
|
||||
}
|
||||
|
||||
if (globalApiKey) {
|
||||
if (globalApiKey?.url) {
|
||||
return `${
|
||||
getProtocol(globalApiKey?.url) === "http" ? "ws://" : "wss://"
|
||||
}${cleanUrl(globalApiKey?.url)}`;
|
||||
|
@ -291,7 +291,8 @@ export const getBaseApi = async (customApi?: string) => {
|
||||
}
|
||||
|
||||
const apiKey = await getApiKeyFromStorage(); // Retrieve apiKey asynchronously
|
||||
if (apiKey) {
|
||||
|
||||
if (apiKey?.url) {
|
||||
return apiKey?.url;
|
||||
} else {
|
||||
return groupApi;
|
||||
@ -299,7 +300,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;
|
||||
@ -313,7 +314,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}`;
|
||||
@ -944,6 +945,7 @@ export async function getBalanceInfo() {
|
||||
const wallet = await getSaveWallet();
|
||||
const address = wallet.address0;
|
||||
const validApi = await getBaseApi();
|
||||
|
||||
const response = await fetch(validApi + "/addresses/balance/" + address);
|
||||
|
||||
if (!response?.ok) throw new Error("0 QORT in your balance");
|
||||
|
Loading…
x
Reference in New Issue
Block a user