From 63d175f842838fd9573c7e10cafb73aec3c82aae Mon Sep 17 00:00:00 2001 From: Ava DeCroix Date: Sun, 30 Apr 2023 15:35:02 -0400 Subject: [PATCH] added axios to get menu in Menu Expansion --- db_app/src/components/Login.js | 17 ++++++++++++++--- db_app/src/components/MenuExpansion.js | 12 ++++++++++++ db_app/src/components/Menus.js | 19 +++++++++++-------- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/db_app/src/components/Login.js b/db_app/src/components/Login.js index c6048ff..04675a4 100644 --- a/db_app/src/components/Login.js +++ b/db_app/src/components/Login.js @@ -16,6 +16,7 @@ import {red, green, lightBlue, lightGreen} from '@mui/material/colors'; import { ThemeProvider, createTheme } from '@mui/material/styles'; import image from "./images/main_background.jpg" import { ReactSession } from 'react-client-session'; +import { CardMedia, CardContent } from '@mui/material'; const theme = createTheme({ palette: { @@ -51,8 +52,6 @@ const [data,setData] = useState({ const submitHandler = e => { e.preventDefault(); - console.log(data); - console.log(net_id[0]) login(); } @@ -96,7 +95,19 @@ const login = () => { }} > Log In - +
+ + + +
+
{ navigate('/'); } +const makeEateryUrl = (eatery) => `http://3.219.93.142:8000/eatery/${eatery}`; + +const getMenu = () => { + const eatery_to_query = getEatery(); + Axios.get(makeEateryUrl(eatery_to_query)).then((response) => { + console.log(response.data); + }); +}; + @@ -84,6 +94,8 @@ return( + + ) diff --git a/db_app/src/components/Menus.js b/db_app/src/components/Menus.js index 1bcf1d8..955cd63 100644 --- a/db_app/src/components/Menus.js +++ b/db_app/src/components/Menus.js @@ -23,6 +23,7 @@ import MenuItem from '@mui/material/MenuItem'; import {red, green, lightBlue, lightGreen} from '@mui/material/colors'; import { ThemeProvider, createTheme } from '@mui/material/styles'; import { ReactSession } from 'react-client-session'; +import Axios from 'axios'; const theme = createTheme({ @@ -56,44 +57,46 @@ const menuExpansion = () => { } const setStarbucks = () => { - ReactSession.set("eatery", "Starbucks"); + ReactSession.set("eatery", 6); menuExpansion(); } const setChick = () => { - ReactSession.set("eatery", "Chick-fil-a"); + ReactSession.set("eatery", 2); menuExpansion(); } const setABP = () => { - ReactSession.set("eatery", "Au Bon Pain"); + ReactSession.set("eatery", 5); menuExpansion(); } const setMoma = () => { - ReactSession.set("eatery", "Modern Market"); + ReactSession.set("eatery", 7); menuExpansion(); } const setTaco = () => { - ReactSession.set("eatery", "Taco Bell"); + ReactSession.set("eatery", 8); menuExpansion(); } const setDH = () => { - ReactSession.set("eatery", "Dining Hall"); + ReactSession.set("eatery", 1); menuExpansion(); } const setFlip = () => { - ReactSession.set("eatery", "Flip Kitchen"); + ReactSession.set("eatery", 4); menuExpansion(); } const setSmash = () => { - ReactSession.set("eatery", "Smashburger"); + ReactSession.set("eatery", 3); menuExpansion(); } + +