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-3.15.0.rc1.3 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.15.0.rc1.2 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.15.0.rc1.1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.15.0.rc1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.14.1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.13.4 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.14.0 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.13.3 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.14.0.rc2 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.13.2 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.14.0.rc1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.13.1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.13.0 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.13.0.rc2.1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.13.0.rc2 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.12.3 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.12.2 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.13.0.rc1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.12.1 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js
katello-3.11.2 webpack/scenes/ModuleStreams/ModuleStreamsReducer.js