fga-eps-mds/2019.1-unbrake

View on GitHub
unbrake-frontend/src/reducer/NotificationReducer.js

Summary

Maintainability
A
0 mins
Test Coverage
import { MESSAGE_USER, TOGGLE_MESSAGE } from "../actions/Types";

const INITIAL_STATE = {
  variante: "",
  message: "",
  condition: false
};

export default (state = INITIAL_STATE, action) => {
  switch (action.type) {
    case MESSAGE_USER:
      return {
        ...state,
        variante: action.payload.variante,
        message: action.payload.message,
        condition: action.payload.condition
      };

    case TOGGLE_MESSAGE:
      return { ...state, condition: action.payload.condition };
    default:
      return state;
  }
};