added axios to get menu in Menu Expansion
This commit is contained in:
@@ -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 = () => {
|
||||
}}
|
||||
>
|
||||
<Typography component="h1" variant="h5">Log In</Typography>
|
||||
|
||||
<div className='logbox2'>
|
||||
<Card sx={{ width:300, height:100 }}>
|
||||
<CardMedia
|
||||
component='Box'
|
||||
image={ require("./images/logo.jpg")}
|
||||
title="Logo"
|
||||
sx={{ width: 300, height:100}}
|
||||
alt="logo"
|
||||
|
||||
/>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
|
||||
<form className='formbox' onSubmit={submitHandler}>
|
||||
<TextField
|
||||
|
||||
@@ -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({
|
||||
@@ -57,6 +58,15 @@ const navigateLogin = () => {
|
||||
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(
|
||||
</Button>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
|
||||
<Button onClick={getMenu}>Test get menu</Button>
|
||||
</ThemeProvider>
|
||||
)
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user