mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-07-28 20:51:24 +00:00
save wallet data when having more than one instance
This commit is contained in:
@@ -250,7 +250,13 @@ export const getApiKeyFromStorage = async (): Promise<string | null> => {
|
||||
};
|
||||
|
||||
export const getCustomNodesFromStorage = async (): Promise<any | null> => {
|
||||
return getData<any>('customNodes').catch(() => null);
|
||||
if (window?.walletStorage) {
|
||||
const res = window.walletStorage.get('customNodes');
|
||||
|
||||
return res || null;
|
||||
} else {
|
||||
return getData<any>('customNodes').catch(() => null);
|
||||
}
|
||||
};
|
||||
|
||||
const getArbitraryEndpoint = async () => {
|
||||
@@ -860,7 +866,20 @@ export async function getSaveWallet() {
|
||||
}
|
||||
|
||||
export async function getWallets() {
|
||||
const res = await getData<any>('wallets').catch(() => null);
|
||||
let res;
|
||||
if (window?.walletStorage) {
|
||||
res = window.walletStorage.get('wallets');
|
||||
if (!res) {
|
||||
const prevWallets = await getData<any>('wallets').catch(() => null);
|
||||
if (prevWallets) {
|
||||
window.walletStorage.set('wallets', prevWallets);
|
||||
res = prevWallets;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = await getData<any>('wallets').catch(() => null);
|
||||
}
|
||||
|
||||
if (res) {
|
||||
return res;
|
||||
} else {
|
||||
@@ -869,9 +888,13 @@ export async function getWallets() {
|
||||
}
|
||||
|
||||
export async function storeWallets(wallets) {
|
||||
storeData('wallets', wallets).catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
if (window?.walletStorage) {
|
||||
window.walletStorage.set('wallets', wallets);
|
||||
} else {
|
||||
storeData('wallets', wallets).catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export async function getUserInfo() {
|
||||
|
Reference in New Issue
Block a user