UI Mechanics / New Look (orange - gray)
This commit is contained in:
36
src/reducers/data.js
Normal file
36
src/reducers/data.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const initialState = {
|
||||
showDishList: false,
|
||||
loggedIn: false,
|
||||
jwt: "",
|
||||
username: "",
|
||||
dialogs: {
|
||||
logIn: false,
|
||||
register: false,
|
||||
contact: false,
|
||||
pricing: false,
|
||||
},
|
||||
};
|
||||
|
||||
const data = (state = initialState, action) => {
|
||||
switch (action.type) {
|
||||
case "SET_DISHLIST_VISIBLE":
|
||||
return (state = { ...state, showDishList: true });
|
||||
case "SET_DISHLIST_HIDDEN":
|
||||
return (state = { ...state, showDishList: false });
|
||||
case "DIALOG_LOGIN_VISIBLE":
|
||||
return (state = { ...state, dialogs: { ...state.dialogs, logIn: true } });
|
||||
case "SET_LOGGEDIN":
|
||||
return (state = { ...state, loggedIn: true, username: action.payload });
|
||||
case "SET_LOGGEDOUT":
|
||||
return (state = { ...state, loggedIn: false, username: "" });
|
||||
case "DIALOG_LOGIN_HIDDEN":
|
||||
return (state = {
|
||||
...state,
|
||||
dialogs: { ...state.dialogs, logIn: false },
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export default data;
|
||||
Reference in New Issue
Block a user