Sha256: 5c86a29070f8487c1b83910321e42e4ce8323c775b6250e82f5892be3cbe2671

Contents?: true

Size: 792 Bytes

Versions: 2

Compression:

Stored size: 792 Bytes

Contents

import Immutable from 'seamless-immutable';
import {
  SUBSCRIPTION_DETAILS_REQUEST,
  SUBSCRIPTION_DETAILS_SUCCESS,
  SUBSCRIPTION_DETAILS_FAILURE,
} from './SubscriptionDetailConstants';

const initialState = Immutable({
  loading: false,
});

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

    case SUBSCRIPTION_DETAILS_SUCCESS: {
      const subscriptionDetails = action.response;

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

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

    default:
      return state;
  }
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
katello-3.8.0.rc2 webpack/scenes/Subscriptions/Details/SubscriptionDetailReducer.js
katello-3.7.0 webpack/scenes/Subscriptions/Details/SubscriptionDetailReducer.js