tahnik/devRantron

View on GitHub
app/src/js/reducers/toast.js

Summary

Maintainability
A
0 mins
Test Coverage
import DEFAULT_STATE from '../consts/default_states';
import { TOAST } from '../consts/types';

export default (state = DEFAULT_STATE.toast, action) => {
  switch (action.type) {
    case TOAST.SHOW:
      return { ...state, text: action.text, isVisible: true };
    case TOAST.HIDE:
      return { ...state, isVisible: false };
    default:
      return state;
  }
};