formatos.js
559 Bytes
import { merge } from 'ramda'
import {
REQUEST_FORMATOS,
RECEIVE_FORMATOS,
} from '../actions/formatos'
const formatos = {
data: [],
current: null,
loading: true,
pages: null,
busqueda: { page: 1, text: '' },
}
export default (state, action) => {
switch (action.type) {
case REQUEST_FORMATOS:
return merge(state, { loading: true, pages: null })
case RECEIVE_FORMATOS:
return merge(
state,
{ loading: false, data: action.formatos, pages: action.pages })
default:
return state || formatos
}
}