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 { ThemeProvider, createTheme } from '@mui/material/styles';
|
||||||
import image from "./images/main_background.jpg"
|
import image from "./images/main_background.jpg"
|
||||||
import { ReactSession } from 'react-client-session';
|
import { ReactSession } from 'react-client-session';
|
||||||
|
import { CardMedia, CardContent } from '@mui/material';
|
||||||
|
|
||||||
const theme = createTheme({
|
const theme = createTheme({
|
||||||
palette: {
|
palette: {
|
||||||
@@ -51,8 +52,6 @@ const [data,setData] = useState({
|
|||||||
|
|
||||||
const submitHandler = e => {
|
const submitHandler = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
console.log(data);
|
|
||||||
console.log(net_id[0])
|
|
||||||
login();
|
login();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -96,6 +95,18 @@ const login = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography component="h1" variant="h5">Log In</Typography>
|
<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}>
|
<form className='formbox' onSubmit={submitHandler}>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import MenuItem from '@mui/material/MenuItem';
|
|||||||
import {red, green, lightBlue, lightGreen} from '@mui/material/colors';
|
import {red, green, lightBlue, lightGreen} from '@mui/material/colors';
|
||||||
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
||||||
import { ReactSession } from 'react-client-session';
|
import { ReactSession } from 'react-client-session';
|
||||||
|
import Axios from 'axios';
|
||||||
|
|
||||||
|
|
||||||
const theme = createTheme({
|
const theme = createTheme({
|
||||||
@@ -57,6 +58,15 @@ const navigateLogin = () => {
|
|||||||
navigate('/');
|
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>
|
</Button>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
|
|
||||||
|
<Button onClick={getMenu}>Test get menu</Button>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import MenuItem from '@mui/material/MenuItem';
|
|||||||
import {red, green, lightBlue, lightGreen} from '@mui/material/colors';
|
import {red, green, lightBlue, lightGreen} from '@mui/material/colors';
|
||||||
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
||||||
import { ReactSession } from 'react-client-session';
|
import { ReactSession } from 'react-client-session';
|
||||||
|
import Axios from 'axios';
|
||||||
|
|
||||||
|
|
||||||
const theme = createTheme({
|
const theme = createTheme({
|
||||||
@@ -56,47 +57,49 @@ const menuExpansion = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const setStarbucks = () => {
|
const setStarbucks = () => {
|
||||||
ReactSession.set("eatery", "Starbucks");
|
ReactSession.set("eatery", 6);
|
||||||
menuExpansion();
|
menuExpansion();
|
||||||
}
|
}
|
||||||
|
|
||||||
const setChick = () => {
|
const setChick = () => {
|
||||||
ReactSession.set("eatery", "Chick-fil-a");
|
ReactSession.set("eatery", 2);
|
||||||
menuExpansion();
|
menuExpansion();
|
||||||
}
|
}
|
||||||
|
|
||||||
const setABP = () => {
|
const setABP = () => {
|
||||||
ReactSession.set("eatery", "Au Bon Pain");
|
ReactSession.set("eatery", 5);
|
||||||
menuExpansion();
|
menuExpansion();
|
||||||
}
|
}
|
||||||
|
|
||||||
const setMoma = () => {
|
const setMoma = () => {
|
||||||
ReactSession.set("eatery", "Modern Market");
|
ReactSession.set("eatery", 7);
|
||||||
menuExpansion();
|
menuExpansion();
|
||||||
}
|
}
|
||||||
|
|
||||||
const setTaco = () => {
|
const setTaco = () => {
|
||||||
ReactSession.set("eatery", "Taco Bell");
|
ReactSession.set("eatery", 8);
|
||||||
menuExpansion();
|
menuExpansion();
|
||||||
}
|
}
|
||||||
|
|
||||||
const setDH = () => {
|
const setDH = () => {
|
||||||
ReactSession.set("eatery", "Dining Hall");
|
ReactSession.set("eatery", 1);
|
||||||
menuExpansion();
|
menuExpansion();
|
||||||
}
|
}
|
||||||
|
|
||||||
const setFlip = () => {
|
const setFlip = () => {
|
||||||
ReactSession.set("eatery", "Flip Kitchen");
|
ReactSession.set("eatery", 4);
|
||||||
menuExpansion();
|
menuExpansion();
|
||||||
}
|
}
|
||||||
|
|
||||||
const setSmash = () => {
|
const setSmash = () => {
|
||||||
ReactSession.set("eatery", "Smashburger");
|
ReactSession.set("eatery", 3);
|
||||||
menuExpansion();
|
menuExpansion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
|
|||||||
Reference in New Issue
Block a user