SnackReducer.js 449 Bytes
Newer Older
Giang Tran committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import {PUSHNOTI, HIDENOTI} from '../actions/actionTypes';

const initialState = {
  isOpen: false,
  screen: '',
  title: '',
  content: '',
  id_record: '',
};
// @ts-ignore

export default function SnackReducer(state = initialState, action) {
  switch (action.type) {
    case PUSHNOTI: {
      return {...action.data, isOpen: true};
    }
    case HIDENOTI: {
      return {...state, isOpen: false};
    }
    default:
      return state;
  }
}