department-of-veterans-affairs/vets-website

View on GitHub
src/applications/mhv-secure-messaging/reducers/preferences.js

Summary

Maintainability
A
0 mins
Test Coverage
import { Actions } from '../util/actionTypes';

const initialState = {
  /**
   * The list of messages being displayed in the folder view/inbox
   * @type {array}
   */
  signature: undefined,
};

export const preferencesReducer = (state = initialState, action) => {
  switch (action.type) {
    case Actions.Preferences.GET_USER_SIGNATURE:
      return {
        ...state,
        signature: action.payload,
      };
    case Actions.Preferences.GET_USER_SIGNATURE_ERROR:
      return {
        ...state,
        signature: undefined,
      };
    default:
      return state;
  }
};