Sha256: 7182dcd3927707aaae4ba84fd3ae80c6a7c96ca8567f01541f23ad343d191c06

Contents?: true

Size: 742 Bytes

Versions: 11

Compression:

Stored size: 742 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,
    perPage: 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-9.1.0 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-9.0.2 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-9.0.1 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-9.0.0 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-7.0.7 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-8.0.0 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-7.0.6 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-7.0.5 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-7.0.4 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-7.0.3 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js
foreman_templates-7.0.2 webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js