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

Version Path
katello-4.3.1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.4.0.rc1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.2.2 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.3.0 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.3.0.rc4 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.3.0.rc3 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.3.0.rc2.1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.3.0.rc2 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.3.0.rc1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.2.1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.2.0.1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.1.4 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.0.3 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.2.0.1.rc3 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.18.5 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.2.0.1.rc2 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.2.0.rc2 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.1.3 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.2.0.rc1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-4.0.2.1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js