Skip to content

Commit

Permalink
clear producer after logout
Browse files Browse the repository at this point in the history
  • Loading branch information
TerenceGe committed Sep 22, 2018
1 parent ee3d647 commit ce47b4a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions shared/actions/producer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export const getProducersWithInfoFailed = createAction<ErrorMessage>('producer/G
export const sortProducers = createAction<string>('producer/SORT')
export const toggleSelect = createAction<string>('producer/TOGGLE_SELECT')
export const setSelected = createAction<any>('producer/SET_SELECT')
export const clearProducer = createAction('producer/CLEAR')
3 changes: 3 additions & 0 deletions shared/reducers/producer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,7 @@ export default handleActions({
[actions.setSelected] (state, action) {
return state.set('selected', action.payload || Immutable.fromJS([]))
},
[actions.clearProducer] () {
return initialState
}
}, initialState)
2 changes: 2 additions & 0 deletions shared/sagas/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { resetBalance, getEOSBalanceRequested, getEOSAssetBalanceListRequested }
import { resetKey } from 'actions/keystore'
import { resetTransaction } from 'actions/transaction'
import { resetEOSAsset } from 'actions/eosAsset'
import { clearProducer } from 'actions/producer'
import { resetEOSAccount, syncEOSAccount, createEOSAccountSucceeded, getEOSAccountRequested, syncEOSAccountCreationInfo } from 'actions/eosAccount'
import { getErrorMessage } from 'utils'
import secureStorage from 'utils/secureStorage'
Expand Down Expand Up @@ -264,6 +265,7 @@ function* logoutRequested(action: Action<LogoutParams>) {
yield put(resetBalance())
yield put(resetTransaction())
yield put(resetKey())
yield put(clearProducer())
yield put(actions.logoutSucceeded())
if (action.payload.componentId) popToRoot(action.payload.componentId)
} catch (e) {
Expand Down

0 comments on commit ce47b4a

Please sign in to comment.