MyCrypto/common/reducers/dashboard.js
2017-04-12 00:04:27 -05:00

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
}
}