Sha256: 34bfd28d39906559234485ab41266918c8565d99ab9675a884d08d5914d20f7d
Contents?: true
Size: 998 Bytes
Versions: 117
Compression:
Stored size: 998 Bytes
Contents
import { initialApiState } from '../../services/api'; import { MODULE_STREAMS_REQUEST, MODULE_STREAMS_SUCCESS, MODULE_STREAMS_FAILURE, } from './ModuleStreamsConstants'; const initialState = initialApiState; export default (state = initialState, action) => { switch (action.type) { case MODULE_STREAMS_REQUEST: { return state.set('loading', true); } case MODULE_STREAMS_SUCCESS: { const { results, page, per_page, subtotal, // eslint-disable-line camelcase } = action.response; return state.merge({ results, loading: false, pagination: { page: Number(page), // eslint-disable-next-line camelcase perPage: Number(per_page || state.pagination.perPage), }, itemCount: Number(subtotal), }); } case MODULE_STREAMS_FAILURE: { return state.merge({ error: action.error, loading: false, }); } default: return state; } };
Version data entries
117 entries across 117 versions & 1 rubygems