insomnia/app/reducers/modals.js
Gregory Schier 4c93317f45 A bunch
2016-04-09 19:58:48 -07:00

20 lines
444 B
JavaScript

import * as types from '../constants/actionTypes';
const initialState = [];
export default function (state = initialState, action) {
switch (action.type) {
case types.MODAL_SHOW:
let id = action.id;
let data = action.data;
return [...state.filter(m => m.id !== action.id), {id, data}];
case types.MODAL_HIDE:
return state.filter(m => m.id !== action.id);
default:
return state
}
}