17 lines
358 B
JavaScript
17 lines
358 B
JavaScript
const dishes = (state = [], action) => {
|
|
switch (action.type) {
|
|
case "SET_DISHES":
|
|
return (state = action.payload);
|
|
case "SET_DISH":
|
|
return [action.payload];
|
|
case "ADD_DISH":
|
|
return [...state, action.payload];
|
|
case "CLEAR_DISHES":
|
|
return (state = []);
|
|
default:
|
|
return state;
|
|
}
|
|
};
|
|
|
|
export default dishes;
|