mirror of
https://github.com/Qortal/chrome-extension.git
synced 2025-03-27 15:55:55 +00:00
save new wallet
This commit is contained in:
parent
77291450c3
commit
7bbe50f881
23
src/App.tsx
23
src/App.tsx
@ -92,10 +92,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,
|
||||||
@ -1086,6 +1088,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) {
|
||||||
@ -1125,6 +1147,7 @@ function App() {
|
|||||||
},
|
},
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response && !response?.error) {
|
if (response && !response?.error) {
|
||||||
|
saveWalletToLocalStorage(wallet)
|
||||||
setRawWallet(wallet);
|
setRawWallet(wallet);
|
||||||
setWalletToBeDownloaded({
|
setWalletToBeDownloaded({
|
||||||
wallet,
|
wallet,
|
||||||
|
@ -577,7 +577,8 @@ const WatchComponent = ({onSeen, isLast, children})=> {
|
|||||||
return <div ref={ref} style={{
|
return <div ref={ref} style={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'center'
|
alignItems: 'center',
|
||||||
|
flexDirection: 'column'
|
||||||
}}>
|
}}>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user