Skip to content

Commit f146e34

Browse files
committed
fix(neuron-ui): set current wallet to empty when all wallets are deleted
1 parent 3d1ef6f commit f146e34

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

packages/neuron-ui/src/states/initStates/wallet.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { addresses, currentWallet } from 'services/localCache'
22

3+
export const emptyWallet: State.Wallet = {
4+
name: '',
5+
id: '',
6+
balance: '0',
7+
addresses: [],
8+
}
9+
310
const wallet = currentWallet.load()
411

512
export const walletState: State.Wallet = {

packages/neuron-ui/src/states/stateProvider/actionCreators/wallets.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
backupWallet as backupRemoteWallet,
1515
showErrorMessage,
1616
} from 'services/remote'
17-
import initStates from 'states/initStates'
17+
import { emptyWallet } from 'states/initStates/wallet'
1818
import { WalletWizardPath } from 'components/WalletWizard'
1919
import i18n from 'utils/i18n'
2020
import { wallets as walletsCache, currentWallet as currentWalletCache } from 'services/localCache'
@@ -26,7 +26,7 @@ import { addNotification, addPopup } from './app'
2626
export const updateCurrentWallet = () => (dispatch: StateDispatch, history: any) => {
2727
getCurrentWallet().then(res => {
2828
if (res.status === 1) {
29-
const payload = res.result || initStates.wallet
29+
const payload = res.result || emptyWallet
3030
if (!payload || !payload.id) {
3131
history.push(`${Routes.WalletWizard}${WalletWizardPath.Welcome}`)
3232
}

0 commit comments

Comments
 (0)