af83/chouette-core

View on GitHub
app/packs/src/vehicle_journeys/reducers/status.js

Summary

Maintainability
A
0 mins
Test Coverage
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
  }
}