mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-04-23 19:37: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;
|
return customApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (globalApiKey) {
|
if (globalApiKey?.url) {
|
||||||
return globalApiKey?.url;
|
return globalApiKey?.url;
|
||||||
} else {
|
} else {
|
||||||
return groupApi;
|
return groupApi;
|
||||||
@ -316,7 +316,7 @@ export const getBaseApiReactSocket = (customApi?: string) => {
|
|||||||
return customApi;
|
return customApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (globalApiKey) {
|
if (globalApiKey?.url) {
|
||||||
return `${
|
return `${
|
||||||
getProtocol(globalApiKey?.url) === "http" ? "ws://" : "wss://"
|
getProtocol(globalApiKey?.url) === "http" ? "ws://" : "wss://"
|
||||||
}${cleanUrl(globalApiKey?.url)}`;
|
}${cleanUrl(globalApiKey?.url)}`;
|
||||||
|
@ -291,7 +291,8 @@ export const getBaseApi = async (customApi?: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const apiKey = await getApiKeyFromStorage(); // Retrieve apiKey asynchronously
|
const apiKey = await getApiKeyFromStorage(); // Retrieve apiKey asynchronously
|
||||||
if (apiKey) {
|
|
||||||
|
if (apiKey?.url) {
|
||||||
return apiKey?.url;
|
return apiKey?.url;
|
||||||
} else {
|
} else {
|
||||||
return groupApi;
|
return groupApi;
|
||||||
@ -299,7 +300,7 @@ export const getBaseApi = async (customApi?: string) => {
|
|||||||
};
|
};
|
||||||
export const isUsingLocal = async () => {
|
export const isUsingLocal = async () => {
|
||||||
const apiKey = await getApiKeyFromStorage(); // Retrieve apiKey asynchronously
|
const apiKey = await getApiKeyFromStorage(); // Retrieve apiKey asynchronously
|
||||||
if (apiKey) {
|
if (apiKey?.url) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -313,7 +314,7 @@ export const createEndpoint = async (endpoint, customApi?: string) => {
|
|||||||
|
|
||||||
const apiKey = await getApiKeyFromStorage(); // Retrieve apiKey asynchronously
|
const apiKey = await getApiKeyFromStorage(); // Retrieve apiKey asynchronously
|
||||||
|
|
||||||
if (apiKey) {
|
if (apiKey?.url) {
|
||||||
// Check if the endpoint already contains a query string
|
// Check if the endpoint already contains a query string
|
||||||
const separator = endpoint.includes("?") ? "&" : "?";
|
const separator = endpoint.includes("?") ? "&" : "?";
|
||||||
return `${apiKey?.url}${endpoint}${separator}apiKey=${apiKey?.apikey}`;
|
return `${apiKey?.url}${endpoint}${separator}apiKey=${apiKey?.apikey}`;
|
||||||
@ -944,6 +945,7 @@ export async function getBalanceInfo() {
|
|||||||
const wallet = await getSaveWallet();
|
const wallet = await getSaveWallet();
|
||||||
const address = wallet.address0;
|
const address = wallet.address0;
|
||||||
const validApi = await getBaseApi();
|
const validApi = await getBaseApi();
|
||||||
|
|
||||||
const response = await fetch(validApi + "/addresses/balance/" + address);
|
const response = await fetch(validApi + "/addresses/balance/" + address);
|
||||||
|
|
||||||
if (!response?.ok) throw new Error("0 QORT in your balance");
|
if (!response?.ok) throw new Error("0 QORT in your balance");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user