Dish cards

This commit is contained in:
2020-07-30 21:04:13 +02:00
parent ad2a945965
commit bf609fc5cd
14 changed files with 173 additions and 2 deletions

View File

@@ -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
View File

@@ -0,0 +1,11 @@
export const showDishes = () => {
return {
type: "SET_DISHLIST_VISIBLE",
};
};
export const hideDishes = () => {
return {
type: "SET_DISHLIST_HIDDEN",
};
};