new look / search list / restaurant view
This commit is contained in:
14
src/reducers/dishes.js
Normal file
14
src/reducers/dishes.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const dishes = (state = [], action) => {
|
||||
switch (action.type) {
|
||||
case "SET_DISHES":
|
||||
return (state = action.payload);
|
||||
case "ADD_DISH":
|
||||
return [...state, action.payload];
|
||||
case "CLEAR_DISHES":
|
||||
return (state = []);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export default dishes;
|
||||
@@ -3,12 +3,16 @@ import autoCompleteReducer from "./autoComplete";
|
||||
import searchResults from "./searchResults";
|
||||
import appMode from "./appMode";
|
||||
import searchQuery from "./searchQuery";
|
||||
import restaurant from "./restaurant";
|
||||
import dishes from "./dishes";
|
||||
|
||||
const rootReducer = combineReducers({
|
||||
autocomplete: autoCompleteReducer,
|
||||
appMode: appMode,
|
||||
searchResults: searchResults,
|
||||
searchQuery: searchQuery,
|
||||
restaurant: restaurant,
|
||||
dishes: dishes,
|
||||
});
|
||||
|
||||
export default rootReducer;
|
||||
|
||||
12
src/reducers/restaurant.js
Normal file
12
src/reducers/restaurant.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const restaurant = (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case "SET_RESTAURANT":
|
||||
return (state = action.payload);
|
||||
case "CLEAR_RESTAURANT":
|
||||
return (state = {});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export default restaurant;
|
||||
Reference in New Issue
Block a user