Skip to content

Commit

Permalink
feat: remove empty current wallet handler from the main view
Browse files Browse the repository at this point in the history
and add the handler in the callback of init function
  • Loading branch information
Keith-CY committed Jul 28, 2019
1 parent 476a918 commit 5810cbb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 1 addition & 3 deletions packages/neuron-ui/src/containers/Main/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import {
Command as CommandSubject,
} from 'services/subjects'
import { ckbCore, getTipBlockNumber, getBlockchainInfo } from 'services/chain'
import { Routes, ConnectionStatus } from 'utils/const'
import { WalletWizardPath } from 'components/WalletWizard'
import { ConnectionStatus } from 'utils/const'
import {
networks as networksCache,
currentNetworkID as currentNetworkIDCache,
Expand Down Expand Up @@ -102,7 +101,6 @@ export const useOnCurrentWalletChange = ({
if (walletID) {
initAppState()(dispatch, history)
} else {
history.push(`${Routes.WalletWizard}${WalletWizardPath.Welcome}`)
initAppState()(dispatch, history)
}
}, [walletID, dispatch, history])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export const initAppState = () => (dispatch: StateDispatch, history: any) => {
transactionList: true,
},
})
setTimeout(() => {})
getNeuronWalletState()
.then(res => {
if (res.status) {
Expand All @@ -39,6 +38,9 @@ export const initAppState = () => (dispatch: StateDispatch, history: any) => {
type: NeuronWalletActions.UpdateTransactionList,
payload: transactions,
})
if (!wallet) {
history.push(`${Routes.WalletWizard}${WalletWizardPath.Welcome}`)
}

currentWalletCache.save(wallet)
walletsCache.save(wallets)
Expand All @@ -47,6 +49,9 @@ export const initAppState = () => (dispatch: StateDispatch, history: any) => {
history.push(`${Routes.WalletWizard}${WalletWizardPath.Welcome}`)
}
})
.catch(() => {
history.push(`${Routes.WalletWizard}${WalletWizardPath.Welcome}`)
})
.finally(() => {
dispatch({
type: AppActions.UpdateLoadings,
Expand Down

0 comments on commit 5810cbb

Please sign in to comment.