mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
20 lines
569 B
JavaScript
20 lines
569 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.remove(list.indexOf(action.value)));
|
|
case RECEIVE_ARCHIVE:
|
|
return state.set('list', new List(action.value));
|
|
default:
|
|
return state;
|
|
}
|
|
};
|
|
|
|
export default archiveStore;
|