mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-04-27 21:37:51 +00:00
save new wallet
This commit is contained in:
parent
fbe876951d
commit
de45a145ca
23
src/App.tsx
23
src/App.tsx
@ -88,10 +88,12 @@ import {
|
||||
cleanUrl,
|
||||
getFee,
|
||||
getProtocol,
|
||||
getWallets,
|
||||
groupApi,
|
||||
groupApiLocal,
|
||||
groupApiSocket,
|
||||
groupApiSocketLocal,
|
||||
storeWallets,
|
||||
} from "./background";
|
||||
import {
|
||||
executeEvent,
|
||||
@ -1007,6 +1009,26 @@ function App() {
|
||||
}
|
||||
};
|
||||
|
||||
const saveWalletToLocalStorage = async (newWallet)=> {
|
||||
try {
|
||||
getWallets().then((res)=> {
|
||||
|
||||
if(res && Array.isArray(res)){
|
||||
const wallets = [...res, newWallet]
|
||||
storeWallets(wallets)
|
||||
} else {
|
||||
storeWallets([newWallet])
|
||||
}
|
||||
setIsLoading(false)
|
||||
}).catch((error)=> {
|
||||
console.error(error)
|
||||
setIsLoading(false)
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
const createAccountFunc = async () => {
|
||||
try {
|
||||
if (!walletToBeDownloadedPassword) {
|
||||
@ -1043,6 +1065,7 @@ function App() {
|
||||
.then((response) => {
|
||||
if (response && !response.error) {
|
||||
setRawWallet(wallet);
|
||||
saveWalletToLocalStorage(wallet)
|
||||
setWalletToBeDownloaded({
|
||||
wallet,
|
||||
qortAddress: wallet.address0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user