From 3c84b1bb4d4d0748b002d2eb996d3363bd27ec7a Mon Sep 17 00:00:00 2001 From: lcross2002 <liamdcross@outlook.com> Date: Tue, 2 Apr 2024 20:57:25 +0100 Subject: [PATCH] Dashboard login register bugfix --- client/src/components/Login/Login.tsx | 4 ++-- client/src/components/Register/Register.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/components/Login/Login.tsx b/client/src/components/Login/Login.tsx index 0eeeacb..2171829 100644 --- a/client/src/components/Login/Login.tsx +++ b/client/src/components/Login/Login.tsx @@ -13,7 +13,7 @@ export interface ILoginForm { } export function Login() { - const { giveAuth, updateUser, user } = useAuth(); + const { giveAuth, updateUser } = useAuth(); const navigate = useNavigate(); const [error, setError] = useState(''); const { register, handleSubmit } = useForm<ILoginForm>({mode: 'onChange'}); @@ -25,7 +25,7 @@ export function Login() { const result = await loginUser(formValue); giveAuth(); updateUser(result.data); - navigate(`/${userToDashboard(user)}`); + navigate(`/${userToDashboard(result.data)}`); } catch (error) { const errorMessage = (error as AxiosError).response?.data; diff --git a/client/src/components/Register/Register.tsx b/client/src/components/Register/Register.tsx index ea69c77..28a373d 100644 --- a/client/src/components/Register/Register.tsx +++ b/client/src/components/Register/Register.tsx @@ -38,7 +38,7 @@ export function Register() { const result = await registerUser(formValue); giveAuth(); updateUser(result.data); - navigate(`/${userToDashboard(user)}`); + navigate(`/${userToDashboard(result.data)}`); } catch (error) { const errorMessage = (error as AxiosError).response?.data; -- GitLab