Sha256: f7b2ad5427df2370cc274b1c309c94adc2c933666e49b5bb67fbc0bcfa8fe23b

Contents?: true

Size: 743 Bytes

Versions: 11

Compression:

Stored size: 743 Bytes

Contents

import Immutable from 'seamless-immutable';
import { deepPropsToCamelCase } from 'foremanReact/common/helpers';

import {
  TEMPLATESYNC_FORM_SUBMITTED,
  SYNC_RESULT_PAGINATION_CHANGE,
} from '../../consts';

export const initialState = Immutable({
  resultAction: '',
  templates: [],

  pagination: {
    page: 1,
    per_page: 20,
  },
});

const syncResult = (state = initialState, action) => {
  const { payload } = action;
  switch (action.type) {
    case TEMPLATESYNC_FORM_SUBMITTED:
      return state.merge({
        ...deepPropsToCamelCase(payload.data),
      });
    case SYNC_RESULT_PAGINATION_CHANGE:
      return state.set('pagination', payload.pagination);
    default:
      return state;
  }
};

export default syncResult;

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
foreman_templates-10.0.2 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-10.0.1 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-10.0.0 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-9.5.1 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-9.5.0 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-9.3.3 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-9.3.2 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-9.3.1 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-9.4.0 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-9.3.0 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-9.2.0 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js