Sha256: 0dc3777864d3efd62a6e0f9c197dd4ca74b51d3b2bfd039714828bdfd5fc3147

Contents?: true

Size: 1.33 KB

Versions: 117

Compression:

Stored size: 1.33 KB

Contents

import Immutable from 'seamless-immutable';
import {
  SUBSCRIPTION_DETAILS_REQUEST,
  SUBSCRIPTION_DETAILS_SUCCESS,
  SUBSCRIPTION_DETAILS_FAILURE,
} from './SubscriptionDetailConstants';
import {
  PRODUCTS_REQUEST,
  PRODUCTS_SUCCESS,
  PRODUCTS_FAILURE,
} from '../../Products/ProductConstants';

const initialState = Immutable({
  loading: false,
  productContent: {
    results: [],
    total: 0,
  },
});

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

    case PRODUCTS_REQUEST: {
      return state.set('loading', true);
    }

    case SUBSCRIPTION_DETAILS_SUCCESS: {
      const subscriptionDetails = action.response;

      return state.merge({
        ...subscriptionDetails,
        loading: false,
      });
    }

    case PRODUCTS_SUCCESS: {
      const productContent = { productContent: action.response };

      return state.merge({
        ...productContent,
        loading: false,
      });
    }

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

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

    default:
      return state;
  }
};

Version data entries

117 entries across 117 versions & 1 rubygems

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