Sha256: a22a532ea8abc8d39367da867f14c9fc65a72333cf8e274a3fedcb13e2904031
Contents?: true
Size: 966 Bytes
Versions: 12
Compression:
Stored size: 966 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
12 entries across 12 versions & 1 rubygems