Dish cards
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import axios from "axios";
|
||||
import * as toggles from "./toggles";
|
||||
|
||||
const autocomplete = (input) => {
|
||||
return {
|
||||
@@ -82,6 +83,7 @@ export const fetchRestaurant = (id) => {
|
||||
.get("http://localhost:4000/restaurant?restaurantId=" + id)
|
||||
.then((response) => {
|
||||
dispatch(setRestaurant(response.data));
|
||||
dispatch(toggles.hideDishes());
|
||||
dispatch(setAppMode("APP_RESTAURANT"));
|
||||
dispatch(fetchAllDishes(id));
|
||||
})
|
||||
@@ -102,6 +104,7 @@ export const fetchAllDishes = (id) => {
|
||||
.get("http://localhost:4000/restaurant/dishes?restaurantId=" + id)
|
||||
.then((response) => {
|
||||
dispatch(setDishes(response.data));
|
||||
dispatch(toggles.showDishes());
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
11
src/actions/toggles.js
Normal file
11
src/actions/toggles.js
Normal file
@@ -0,0 +1,11 @@
|
||||
export const showDishes = () => {
|
||||
return {
|
||||
type: "SET_DISHLIST_VISIBLE",
|
||||
};
|
||||
};
|
||||
|
||||
export const hideDishes = () => {
|
||||
return {
|
||||
type: "SET_DISHLIST_HIDDEN",
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user