Sha256: f21c0450f44b7ffd8d11d7624ad6f745c301a7e7983cbf84ac33add0151b1abd

Contents?: true

Size: 801 Bytes

Versions: 11

Compression:

Stored size: 801 Bytes

Contents

import Immutable from 'seamless-immutable';
import { actionTypeGenerator } from 'foremanReact/redux/API';

export const initialState = Immutable({
  sccProducts: [],
  sccAccountId: undefined,
});

export default (state = initialState, action) => {
  const { payload } = action;

  const listTypes = actionTypeGenerator('SCC_PRODUCT_LIST');

  switch (action.type) {
    case 'FETCH_PRODUCT_SUCCESS':
      return state.merge({
        sccProducts: payload,
      });
    case listTypes.REQUEST:
      return state.merge({
        sccProducts: [],
      });
    case listTypes.SUCCESS:
      return state.merge({
        sccProducts: payload.data,
      });
    case listTypes.FAILURE:
      return state.merge({
        sccProducts: [payload.error],
      });
    default:
      return state;
  }
};

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
foreman_scc_manager-4.0.0 webpack/components/SCCProductPage/SCCProductPageReducer.js
foreman_scc_manager-3.1.1 webpack/components/SCCProductPage/SCCProductPageReducer.js
foreman_scc_manager-3.1.0 webpack/components/SCCProductPage/SCCProductPageReducer.js
foreman_scc_manager-3.0.0 webpack/components/SCCProductPage/SCCProductPageReducer.js
foreman_scc_manager-2.3.0 webpack/components/SCCProductPage/SCCProductPageReducer.js
foreman_scc_manager-2.2.3 webpack/components/SCCProductPage/SCCProductPageReducer.js
foreman_scc_manager-2.2.2 webpack/components/SCCProductPage/SCCProductPageReducer.js
foreman_scc_manager-2.2.1 webpack/components/SCCProductPage/SCCProductPageReducer.js
foreman_scc_manager-2.2.0 webpack/components/SCCProductPage/SCCProductPageReducer.js
foreman_scc_manager-2.1.0 webpack/components/SCCProductPage/SCCProductPageReducer.js
foreman_scc_manager-2.0.0 webpack/components/SCCProductPage/SCCProductPageReducer.js