Blame view

jaikuaamina-app/redux/reducers/soportes.js 687 Bytes
Guillermo Osorio authored
1 2 3 4 5
import { merge } from 'ramda'

import {
  REQUEST_SOPORTES,
  RECEIVE_SOPORTES,
Galileo Sanchez authored
6
  ERROR_SOPORTES
Guillermo Osorio authored
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
} from '../actions/soportes'


const soportes = {
  data: [],
  current: null,
  loading: true,
  pages: null,
  busqueda: { page: 1, text: '' },
}

export default (state, action) => {
  switch (action.type) {
    case REQUEST_SOPORTES:
      return merge(state, { loading: true, pages: null })
    case RECEIVE_SOPORTES:
      return merge(
        state,
        { loading: false, data: action.soportes, pages: action.pages })
Galileo Sanchez authored
26 27 28 29
    case ERROR_SOPORTES:
      return merge(
        state,
        { loading: false, data: [], pages: null })
Guillermo Osorio authored
30 31 32 33
    default:
      return state || soportes
  }
}