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

Version Path
katello-3.18.2 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.17.3 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-4.0.0.rc2 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.18.1.1 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.17.2 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-4.0.0.rc1 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.18.1 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.18.0 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.17.1 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.16.2 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.18.0.rc2.1 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.18.0.rc2 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.17.0 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.18.0.rc1 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.17.0.rc2.2 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.17.0.rc2.1 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.16.1.2 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.16.1.1 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.17.0.rc2 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js
katello-3.16.1 webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js