mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
20 lines
444 B
JavaScript
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
|
||
|
}
|
||
|
}
|