diff --git a/src/client/src/FrontPage.js b/src/client/src/FrontPage.js index 6321fea..2c027fe 100644 --- a/src/client/src/FrontPage.js +++ b/src/client/src/FrontPage.js @@ -219,6 +219,7 @@ class LoginManager { } console.log(data); this.user = data.data; + return this.user; }) .catch((err) => console.log(err.message)); } diff --git a/src/client/src/ProfilePage.js b/src/client/src/ProfilePage.js index 39bdd3d..5ca3dcd 100644 --- a/src/client/src/ProfilePage.js +++ b/src/client/src/ProfilePage.js @@ -5,16 +5,17 @@ import ErrorSnackbar from "./components/ErrorSnackbar"; import { Button, TextField, Stack, InputLabel, Select, Container, Slider, Paper, Box, Grid, Typography } from '@mui/material'; export default function ProfilePage(props) { - if (!props.login) { - return

Something went very wrong

- } + const [loggedIn, setLoggedIn] = React.useState(props.login.isLoggedIn()); + React.useEffect(() => { + setLoggedIn(props.login.isLoggedIn()); + }, [props.login]); + let user = props.login.user; - console.log(props.login); return (<> - {props.login.isLoggedIn() ? <> + {loggedIn ? <>

Your profile