aboutsummaryrefslogtreecommitdiffstats
path: root/app/javascript/vehicle_journeys/reducers/status.js
blob: 0bbb0512488364c5754ee0257b21da2950d2692e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import _ from 'lodash'
import actions from '../actions'

export default function status(state = {}, action) {
  switch (action.type) {
    case 'UNAVAILABLE_SERVER':
      return _.assign({}, state, {fetchSuccess: false})
    case 'FETCH_API':
      return _.assign({}, state, {isFetching: true})
    case 'RECEIVE_VEHICLE_JOURNEYS':
      return _.assign({}, state, {fetchSuccess: true, isFetching: false})
    case 'RECEIVE_ERRORS':
      return _.assign({}, state, {fetchSuccess: true, isFetching: false})
    default:
      return state
  }
}