Merge global search.

This commit is contained in:
Ahmed Bouhuolia
2020-04-14 19:23:43 +02:00
10 changed files with 90 additions and 88 deletions

View File

@@ -8,26 +8,11 @@ const initialState = {
};
export default createReducer(initialState, {
[t.SEARCH_SUCCESS]: (state, action) => {
const _result = {};
action.searches.forEach((search) => {
_result[search.id] = search;
});
state.searches = {
...state.searches,
..._result,
};
[t.OPEN_SEARCH]: (state, action) => {
state.isOpen = true;
},
});
// return state = action.result;
// if (typeof state === 'undefined') {
// return initialState;
// }
// state.search[action.name] = {
// isOpen: true,
// payload: action.payload || {},
// };
[t.CLOSE_SEARCH]: (state, action) => {
state.isOpen = false;
}
});