Logout ability
This commit is contained in:
parent
4c45341e31
commit
87becaf5c0
|
@ -9,9 +9,11 @@ import Menu from '@material-ui/core/Menu';
|
|||
import MenuItem from '@material-ui/core/MenuItem';
|
||||
import { clusterApiUrl } from '@solana/web3.js';
|
||||
import { useWalletSelector } from '../utils/wallet';
|
||||
import { forgetWallet } from '../utils/wallet-seed';
|
||||
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
||||
import CheckIcon from '@material-ui/icons/Check';
|
||||
import AddIcon from '@material-ui/icons/Add';
|
||||
import ExitToApp from '@material-ui/icons/ExitToApp';
|
||||
import AccountIcon from '@material-ui/icons/AccountCircle';
|
||||
import Divider from '@material-ui/core/Divider';
|
||||
import Hidden from '@material-ui/core/Hidden';
|
||||
|
@ -188,6 +190,12 @@ function WalletSelector() {
|
|||
</ListItemIcon>
|
||||
Create Account
|
||||
</MenuItem>
|
||||
<MenuItem onClick={forgetWallet}>
|
||||
<ListItemIcon className={classes.menuItemIcon}>
|
||||
<ExitToApp fontSize="small" />
|
||||
</ListItemIcon>
|
||||
Logout
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</>
|
||||
);
|
||||
|
|
|
@ -111,3 +111,13 @@ async function deriveEncryptionKey(password, salt, iterations, digest) {
|
|||
export function lockWallet() {
|
||||
setUnlockedMnemonicAndSeed(null, null);
|
||||
}
|
||||
|
||||
export function forgetWallet() {
|
||||
localStorage.removeItem('walletIndex');
|
||||
localStorage.removeItem('walletCount');
|
||||
localStorage.removeItem('locked');
|
||||
localStorage.removeItem('unlocked');
|
||||
sessionStorage.removeItem('unlocked');
|
||||
unlockedMnemonicAndSeed = { mnemonic: null, seed: null };
|
||||
walletSeedChanged.emit('change', unlockedMnemonicAndSeed);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue