web client v0.5
//notifications //delete restaurant //change picture //redesigned data store
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
const initialState = {
|
||||
showDishList: false,
|
||||
loggedIn: false,
|
||||
jwt: "",
|
||||
username: "",
|
||||
userId: "",
|
||||
userEmail: "",
|
||||
@@ -19,16 +18,9 @@ const initialState = {
|
||||
restaurants: [],
|
||||
},
|
||||
dialogs: {
|
||||
registerCircularProgress: false,
|
||||
registerForm: true,
|
||||
registerResult: "",
|
||||
loginResult: "",
|
||||
regulamin: false,
|
||||
reminderResult: "",
|
||||
reminderCircularProgress: false,
|
||||
resetResult: "",
|
||||
resetCircularProgress: false,
|
||||
},
|
||||
backdrop: false,
|
||||
tempData: {},
|
||||
};
|
||||
|
||||
@@ -74,11 +66,6 @@ const data = (state = initialState, action) => {
|
||||
restaurants: [],
|
||||
},
|
||||
});
|
||||
case "DIALOG_REGISTER_CIRCLE_SHOW":
|
||||
return (state = {
|
||||
...state,
|
||||
dialogs: { ...state.dialogs, registerCircularProgress: true },
|
||||
});
|
||||
case "DIALOG_REGULAMIN_SHOW":
|
||||
return (state = {
|
||||
...state,
|
||||
@@ -89,60 +76,28 @@ const data = (state = initialState, action) => {
|
||||
...state,
|
||||
dialogs: { ...state.dialogs, regulamin: false },
|
||||
});
|
||||
case "DIALOG_REGISTER_CIRCLE_HIDE":
|
||||
return (state = {
|
||||
...state,
|
||||
dialogs: { ...state.dialogs, registerCircularProgress: false },
|
||||
});
|
||||
case "DIALOG_REGISTER_FORM_HIDE":
|
||||
return (state = {
|
||||
...state,
|
||||
dialogs: { ...state.dialogs, registerForm: false },
|
||||
});
|
||||
case "DIALOG_REGISTER_SET_RESULT":
|
||||
return (state = {
|
||||
...state,
|
||||
dialogs: { ...state.dialogs, registerResult: action.payload },
|
||||
});
|
||||
case "DIALOG_REMINDER_SET_RESULT":
|
||||
return (state = {
|
||||
...state,
|
||||
dialogs: { ...state.dialogs, reminderResult: action.payload },
|
||||
});
|
||||
case "DIALOG_REMINDER_CIRCLE_SHOW":
|
||||
return (state = {
|
||||
...state,
|
||||
dialogs: { ...state.dialogs, reminderCircularProgress: true },
|
||||
});
|
||||
case "DIALOG_REMINDER_CIRCLE_HIDE":
|
||||
return (state = {
|
||||
...state,
|
||||
dialogs: { ...state.dialogs, reminderCircularProgress: false },
|
||||
});
|
||||
case "DIALOG_RESET_CIRCLE_SHOW":
|
||||
return (state = {
|
||||
...state,
|
||||
dialogs: { ...state.dialogs, resetCircularProgress: true },
|
||||
});
|
||||
case "DIALOG_RESET_CIRCLE_HIDE":
|
||||
return (state = {
|
||||
...state,
|
||||
dialogs: { ...state.dialogs, resetCircularProgress: false },
|
||||
});
|
||||
case "DIALOG_LOGIN_SET_RESULT":
|
||||
return (state = {
|
||||
...state,
|
||||
dialogs: { ...state.dialogs, loginResult: action.payload },
|
||||
});
|
||||
case "DIALOG_RESET_SET_RESULT":
|
||||
return (state = {
|
||||
...state,
|
||||
dialogs: { ...state.dialogs, resetResult: action.payload },
|
||||
});
|
||||
case "SET_TEMP_DATA":
|
||||
return (state = { ...state, tempData: action.payload });
|
||||
case "CLEAR_TEMP_DATA":
|
||||
return (state = { ...state, tempData: {} });
|
||||
case "SHOW_BACKDROP":
|
||||
return (state = { ...state, backdrop: true });
|
||||
case "HIDE_BACKDROP":
|
||||
return (state = { ...state, backdrop: false });
|
||||
case "UPDATE_RESTAURANT":
|
||||
return (state = {
|
||||
...state,
|
||||
userData: {
|
||||
...state.userData,
|
||||
restaurants: state.userData.restaurants.map((restaurant) => {
|
||||
if (restaurant._id === action.payload._id) {
|
||||
return action.payload;
|
||||
} else {
|
||||
return restaurant;
|
||||
}
|
||||
}),
|
||||
},
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user