mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-02-14 20:19:47 +00:00
27 lines
673 B
JavaScript
27 lines
673 B
JavaScript
import {GET_STATISTICS_SUCCESS, GET_STATISTICS_FAIL} from 'actions/dashboard'
|
|
import {LOCATION_CHANGE} from 'actions/common'
|
|
|
|
const initialState = {
|
|
statistics: []
|
|
}
|
|
|
|
export function dashboard(state = initialState, action) {
|
|
switch (action.type) {
|
|
case GET_STATISTICS_SUCCESS:
|
|
return {
|
|
...state,
|
|
statistics: action.result
|
|
}
|
|
case GET_STATISTICS_FAIL:
|
|
return state
|
|
case LOCATION_CHANGE: {
|
|
if (action.payload.pathname !== '/') {
|
|
return initialState
|
|
}
|
|
return state
|
|
}
|
|
default:
|
|
return state
|
|
}
|
|
}
|