diff --git a/client/src/components/Login/Login.tsx b/client/src/components/Login/Login.tsx index 0eeeacbb9d6cf19c18d91d46ea396fcbd23bfd52..21718298187769aafc80983bbf6187082ab2ec15 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 ea69c77e51851277e170a791e9aa666d2a3f2b14..28a373d8652698675ae92777b8f1df7472093200 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;