Sha256: b98de4e8c5b0b736f2ad385e097315652a13db5918a49c8c4c9e9dd0e934a7c3

Contents?: true

Size: 857 Bytes

Versions: 3

Compression:

Stored size: 857 Bytes

Contents

import Immutable from 'seamless-immutable';

import {
  PREUPGRADE_REPORTS_REQUEST,
  PREUPGRADE_REPORTS_SUCCESS,
  PREUPGRADE_REPORTS_FAILURE,
} from '../../consts';

export const initialState = Immutable({
  loadingPreupgradeReports: false,
  preupgradeReports: [],
  error: {},
});

const reducer = (state = initialState, action) => {
  const { payload } = action;
  switch (action.type) {
    case PREUPGRADE_REPORTS_REQUEST:
      return state.set('loadingPreupgradeReports', true);
    case PREUPGRADE_REPORTS_SUCCESS:
      return state.merge({
        loadingPreupgradeReports: false,
        preupgradeReports: payload.results,
      });
    case PREUPGRADE_REPORTS_FAILURE:
      return state.merge({
        error: payload.error,
        loadingPreupgradeReports: false,
      });
    default:
      return state;
  }
};

export default reducer;

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_leapp-0.0.6 webpack/components/PreupgradeReports/PreupgradeReportsReducer.js
foreman_leapp-0.0.5 webpack/components/PreupgradeReports/PreupgradeReportsReducer.js
foreman_leapp-0.0.4 webpack/components/PreupgradeReports/PreupgradeReportsReducer.js