mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-05-09 11:17:51 +00:00
save new wallet
This commit is contained in:
parent
d3af9bf726
commit
36d34a631d
23
src/App.tsx
23
src/App.tsx
@ -88,10 +88,12 @@ import {
|
|||||||
cleanUrl,
|
cleanUrl,
|
||||||
getFee,
|
getFee,
|
||||||
getProtocol,
|
getProtocol,
|
||||||
|
getWallets,
|
||||||
groupApi,
|
groupApi,
|
||||||
groupApiLocal,
|
groupApiLocal,
|
||||||
groupApiSocket,
|
groupApiSocket,
|
||||||
groupApiSocketLocal,
|
groupApiSocketLocal,
|
||||||
|
storeWallets,
|
||||||
} from "./background";
|
} from "./background";
|
||||||
import {
|
import {
|
||||||
executeEvent,
|
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 () => {
|
const createAccountFunc = async () => {
|
||||||
try {
|
try {
|
||||||
if (!walletToBeDownloadedPassword) {
|
if (!walletToBeDownloadedPassword) {
|
||||||
@ -1043,6 +1065,7 @@ function App() {
|
|||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response && !response.error) {
|
if (response && !response.error) {
|
||||||
setRawWallet(wallet);
|
setRawWallet(wallet);
|
||||||
|
saveWalletToLocalStorage(wallet)
|
||||||
setWalletToBeDownloaded({
|
setWalletToBeDownloaded({
|
||||||
wallet,
|
wallet,
|
||||||
qortAddress: wallet.address0,
|
qortAddress: wallet.address0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user