Sha256: a44f2d58c3e3ce78eaceefc66bae9ba3ce61999d0b43601ed1ea47e7015210ab

Contents?: true

Size: 1.54 KB

Versions: 58

Compression:

Stored size: 1.54 KB

Contents

import { initialApiState } from '../../../services/api';

import {
  UPSTREAM_SUBSCRIPTIONS_REQUEST,
  UPSTREAM_SUBSCRIPTIONS_SUCCESS,
  UPSTREAM_SUBSCRIPTIONS_FAILURE,
  SAVE_UPSTREAM_SUBSCRIPTIONS_REQUEST,
  SAVE_UPSTREAM_SUBSCRIPTIONS_SUCCESS,
  SAVE_UPSTREAM_SUBSCRIPTIONS_FAILURE,
} from './UpstreamSubscriptionsContstants';

const initialState = initialApiState;

export default (state = initialState, action) => {
  switch (action.type) {
    case UPSTREAM_SUBSCRIPTIONS_REQUEST:
      return state.set('loading', true);

    case UPSTREAM_SUBSCRIPTIONS_SUCCESS: {
      const {
        page, per_page, total, results, // eslint-disable-line camelcase

      } = action.response;

      return state.merge({
        results,
        loading: false,
        searchIsActive: !!action.search,
        search: action.search,
        pagination: {
          page: Number(page),
          // eslint-disable-next-line camelcase
          perPage: Number(per_page || state.pagination.perPage),
        },
        itemCount: Number(total),
      });
    }

    case UPSTREAM_SUBSCRIPTIONS_FAILURE:
      return state.merge({
        error: action.payload.message,
        loading: false,
      });

    case SAVE_UPSTREAM_SUBSCRIPTIONS_REQUEST:
      return state.set('loading', true);

    case SAVE_UPSTREAM_SUBSCRIPTIONS_SUCCESS:
      return state.set('task', action.response).set('loading', false);

    case SAVE_UPSTREAM_SUBSCRIPTIONS_FAILURE: {
      return state.set('error', action.payload.message).set('loading', false);
    }

    default:
      return state;
  }
};

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
katello-3.15.3.1 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.15.3 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.16.0.rc3.1 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.15.2 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.16.0.rc3 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.16.0.rc2.1 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.16.0.rc2 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.15.1.1 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.16.0.rc1.1 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.15.1 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.16.0.rc1 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.15.0.1 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.15.0 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.15.0.rc2 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.15.0.rc1.3 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.15.0.rc1.2 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.15.0.rc1.1 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.15.0.rc1 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.14.1 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js
katello-3.13.4 webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js