huridocs/uwazi

View on GitHub
app/react/Settings/reducers/uiReducer.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import Immutable from 'immutable';
import * as actions from '../actions/actionTypes';

export default function settingsUI(state = {}, action = {}) {
  if (action.type === actions.EDIT_LINK) {
    return state.set('editingLink', action.id);
  }

  if (action.type === actions.SAVING_NAVLINKS) {
    return state.set('savingNavlinks', true);
  }

  if (action.type === actions.NAVLINKS_SAVED) {
    return state.set('savingNavlinks', false);
  }

  return Immutable.fromJS(state);
}