Sha256: b6adeecfddade8f9158d6fc394e6b5e4007f0e3be8933ba0790dd17f9d66eec9

Contents?: true

Size: 914 Bytes

Versions: 23

Compression:

Stored size: 914 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,
  reportsExpected: 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,
        reportsExpected: true,
      });
    case PREUPGRADE_REPORTS_FAILURE:
      return state.merge({
        error: payload.error,
        loadingPreupgradeReports: false,
      });
    default:
      return state;
  }
};

export default reducer;

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
foreman_leapp-0.1.2 webpack/components/PreupgradeReports/PreupgradeReportsReducer.js
foreman_leapp-0.1.1 webpack/components/PreupgradeReports/PreupgradeReportsReducer.js
foreman_leapp-0.1.0 webpack/components/PreupgradeReports/PreupgradeReportsReducer.js