From c0c91c7e49d549eb7b1503950b1953d29c435043 Mon Sep 17 00:00:00 2001 From: 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 Date: Mon, 22 Apr 2024 12:14:10 +0200 Subject: [PATCH] login hotfix --- webapp/src/components/AddUser.jsx | 2 +- webapp/src/components/Login.jsx | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/webapp/src/components/AddUser.jsx b/webapp/src/components/AddUser.jsx index b3bda9f..3b0ef7b 100644 --- a/webapp/src/components/AddUser.jsx +++ b/webapp/src/components/AddUser.jsx @@ -1,7 +1,7 @@ // src/components/AddUser.js import React, { useState } from 'react'; import axios from 'axios'; -import { Snackbar } from '@mui/material'; +import { Container, Typography, TextField, Button, Snackbar } from '@mui/material'; import { Link } from 'react-router-dom'; import { useNavigate } from 'react-router-dom'; const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || 'http://localhost:8000'; diff --git a/webapp/src/components/Login.jsx b/webapp/src/components/Login.jsx index 94d0db5..4559556 100644 --- a/webapp/src/components/Login.jsx +++ b/webapp/src/components/Login.jsx @@ -1,16 +1,17 @@ // src/components/Login.js import React, { useState } from 'react'; import axios from 'axios'; -import { Snackbar } from '@mui/material'; + import useSignIn from 'react-auth-kit/hooks/useSignIn'; -// import { useNavigate } from 'react-router-dom'; +import { Container, Typography, TextField, Button, Snackbar } from '@mui/material'; +import { useNavigate } from 'react-router-dom'; import { Link } from 'react-router-dom'; const Login = () => { const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const signIn = useSignIn(); - // const navigate = useNavigate(); + const navigate = useNavigate(); const [openSnackbar, setOpenSnackbar] = useState(false); const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || 'http://localhost:8000'; @@ -33,8 +34,8 @@ const Login = () => { } })) { // Only if you are using refreshToken feature // Redirect or do-something - // navigate('/'); - window.location.href = '/'; + navigate('/'); + //window.location.href = '/'; } else { //Throw error