From 1a361a5948be2804799206985db48546821f954d Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Thu, 14 Sep 2023 17:57:50 +0800 Subject: [PATCH] update user loggin --- src/auth/index.js | 2 +- src/pages/authentication/auth-forms/AuthLoginCustom.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/auth/index.js b/src/auth/index.js index ba3e979..db38d50 100644 --- a/src/auth/index.js +++ b/src/auth/index.js @@ -58,7 +58,7 @@ export const handleLogoutFunction = () => { } ) - console.log("logout"); + // console.log("logout"); // ** Remove user, accessToken & refreshToken from localStorage localStorage.removeItem('userData') localStorage.removeItem('accessToken') diff --git a/src/pages/authentication/auth-forms/AuthLoginCustom.js b/src/pages/authentication/auth-forms/AuthLoginCustom.js index 623eca7..57e478f 100644 --- a/src/pages/authentication/auth-forms/AuthLoginCustom.js +++ b/src/pages/authentication/auth-forms/AuthLoginCustom.js @@ -41,7 +41,7 @@ import iAmSmartICon from 'assets/images/icons/icon_iAmSmart.png'; import {useDispatch} from "react-redux"; import {handleLogin} from "auth/index"; import useJwt from "../../../auth/jwt/useJwt"; - +import { handleLogoutFunction } from 'auth/index'; // ============================|| FIREBASE - LOGIN ||============================ // const AuthLoginCustom = () => { @@ -65,11 +65,12 @@ const AuthLoginCustom = () => { const tryLogin = () => { if(isValid){ + dispatch(handleLogoutFunction()); // setSumitting(true) useJwt .login({username: values.username, password: values.password}) .then((response) => { - // console.log("123") + console.log(response) const userData = { id: response.data.id, fullenName: response.data.name, @@ -92,7 +93,6 @@ const AuthLoginCustom = () => { console.error(error.response.data.error) setErrorMassage(error.response.data.error) setOpen(true) - console.log("321") }); }else{ setOpen(true)