32 lines
567 B
JavaScript
Raw Normal View History

/*
*
* HomePage reducer
*
*/
2018-02-16 14:17:24 +01:00
import { fromJS, List } from 'immutable';
2018-02-16 14:17:24 +01:00
import {
DROP_SUCCESS,
ON_SEARCH,
} from './constants';
const initialState = fromJS({
search: '',
2018-02-16 14:17:24 +01:00
uploadedFiles: List([]),
});
function homePageReducer(state = initialState, action) {
switch (action.type) {
2018-02-16 14:17:24 +01:00
case DROP_SUCCESS:
return state
.update('uploadedFiles', (list) => List(action.newFiles).concat(list));
case ON_SEARCH:
return state.update('search', () => action.value);
default:
return state;
}
}
export default homePageReducer;