This commit is contained in:
Felix Albrigtsen 2022-04-23 15:06:23 +02:00
parent 6119a7cadf
commit c20cea953d
2 changed files with 7 additions and 5 deletions

View File

@ -219,6 +219,7 @@ class LoginManager {
} }
console.log(data); console.log(data);
this.user = data.data; this.user = data.data;
return this.user;
}) })
.catch((err) => console.log(err.message)); .catch((err) => console.log(err.message));
} }

View File

@ -5,16 +5,17 @@ import ErrorSnackbar from "./components/ErrorSnackbar";
import { Button, TextField, Stack, InputLabel, Select, Container, Slider, Paper, Box, Grid, Typography } from '@mui/material'; import { Button, TextField, Stack, InputLabel, Select, Container, Slider, Paper, Box, Grid, Typography } from '@mui/material';
export default function ProfilePage(props) { export default function ProfilePage(props) {
if (!props.login) { const [loggedIn, setLoggedIn] = React.useState(props.login.isLoggedIn());
return <h1>Something went very wrong</h1> React.useEffect(() => {
} setLoggedIn(props.login.isLoggedIn());
}, [props.login]);
let user = props.login.user; let user = props.login.user;
console.log(props.login);
return (<> return (<>
<AppBar pageTitle="Profile" /> <AppBar pageTitle="Profile" />
<Container sx={{minHeight: "30vh", width: "90vw", padding: "20px 20px"}} component={Container} direction="column" align="center"> <Container sx={{minHeight: "30vh", width: "90vw", padding: "20px 20px"}} component={Container} direction="column" align="center">
{props.login.isLoggedIn() ? <> {loggedIn ? <>
<Paper sx={{minHeight: "30vh", width: "90vw", margin: "10px auto"}} component={Stack} direction="column" justifyContent="center"> <Paper sx={{minHeight: "30vh", width: "90vw", margin: "10px auto"}} component={Stack} direction="column" justifyContent="center">
<div align="center"> <div align="center">
<h2><b>Your profile</b></h2> <h2><b>Your profile</b></h2>