Config With Seacrh

This commit is contained in:
elforjani3
2020-04-11 15:00:22 +02:00
parent e8079dbde3
commit 940418c4e0
12 changed files with 284 additions and 149 deletions

View File

@@ -0,0 +1,33 @@
import t from 'store/types';
import { createReducer } from '@reduxjs/toolkit';
const initialState = {
searches: {},
searchTitle: 'Title',
isOpen: false,
};
export default createReducer(initialState, {
[t.SEARCH_SUCCESS]: (state, action) => {
const _result = {};
action.searches.forEach((search) => {
_result[search.id] = search;
});
state.searches = {
...state.searches,
..._result,
};
},
});
// return state = action.result;
// if (typeof state === 'undefined') {
// return initialState;
// }
// state.search[action.name] = {
// isOpen: true,
// payload: action.payload || {},
// };