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