1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/frontend/src/store/archive-store.js
Simen Bekkhus 683ae7e6d8 Use prettier (#87)
* Use prettier

* Upgrade to 1.6 beta

* Update lint deps

* Upgrade to full 1.6
2017-08-28 19:15:47 +02:00

22 lines
603 B
JavaScript

import { List, Map as $Map } from 'immutable';
import { RECEIVE_ARCHIVE, REVIVE_TOGGLE } from './archive-actions';
function getInitState() {
return new $Map({ list: new List() });
}
const archiveStore = (state = getInitState(), action) => {
switch (action.type) {
case REVIVE_TOGGLE:
return state.update('list', list =>
list.filter(item => item.name !== action.value)
);
case RECEIVE_ARCHIVE:
return state.set('list', new List(action.value));
default:
return state;
}
};
export default archiveStore;