diff --git a/webapp/src/components/Login/Login.js b/webapp/src/components/Login/Login.js index 6c89c8ee..f7f5f779 100644 --- a/webapp/src/components/Login/Login.js +++ b/webapp/src/components/Login/Login.js @@ -2,6 +2,7 @@ import React, { useState } from 'react'; import axios from 'axios'; import { Container, Typography, TextField, Button, Snackbar } from '@mui/material'; +import {Navigate, useNavigate} from "react-router-dom"; const Login = () => { const [username, setUsername] = useState(''); @@ -10,6 +11,7 @@ const Login = () => { const [loginSuccess, setLoginSuccess] = useState(false); const [createdAt, setCreatedAt] = useState(''); const [openSnackbar, setOpenSnackbar] = useState(false); + const navigate = useNavigate(); const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || 'http://localhost:8000'; @@ -40,14 +42,7 @@ const Login = () => { return ( {loginSuccess ? ( -
- - Hello {username}! - - - Your account was created on {new Date(createdAt).toLocaleDateString()}. - -
+ navigate("/home") ) : (