new look / search list / restaurant view
This commit is contained in:
@@ -68,3 +68,40 @@ export const setAppMode = (mode) => {
|
||||
type: mode,
|
||||
};
|
||||
};
|
||||
|
||||
export const setRestaurant = (restaurant) => {
|
||||
return {
|
||||
type: "SET_RESTAURANT",
|
||||
payload: restaurant,
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchRestaurant = (id) => {
|
||||
return function (dispatch) {
|
||||
axios
|
||||
.get("http://localhost:4000/restaurant?restaurantId=" + id)
|
||||
.then((response) => {
|
||||
dispatch(setRestaurant(response.data));
|
||||
dispatch(setAppMode("APP_RESTAURANT"));
|
||||
dispatch(fetchAllDishes(id));
|
||||
})
|
||||
.catch((err) => console.log(err));
|
||||
};
|
||||
};
|
||||
|
||||
const setDishes = (data) => {
|
||||
return {
|
||||
type: "SET_DISHES",
|
||||
payload: data,
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchAllDishes = (id) => {
|
||||
return function (dispatch) {
|
||||
axios
|
||||
.get("http://localhost:4000/restaurant/dishes?restaurantId=" + id)
|
||||
.then((response) => {
|
||||
dispatch(setDishes(response.data));
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user