Browse Source

update user loggin

master
Alex Cheung 1 year ago
parent
commit
1a361a5948
2 changed files with 4 additions and 4 deletions
  1. +1
    -1
      src/auth/index.js
  2. +3
    -3
      src/pages/authentication/auth-forms/AuthLoginCustom.js

+ 1
- 1
src/auth/index.js View File

@@ -58,7 +58,7 @@ export const handleLogoutFunction = () => {
} }
) )


console.log("logout");
// console.log("logout");
// ** Remove user, accessToken & refreshToken from localStorage // ** Remove user, accessToken & refreshToken from localStorage
localStorage.removeItem('userData') localStorage.removeItem('userData')
localStorage.removeItem('accessToken') localStorage.removeItem('accessToken')


+ 3
- 3
src/pages/authentication/auth-forms/AuthLoginCustom.js View File

@@ -41,7 +41,7 @@ import iAmSmartICon from 'assets/images/icons/icon_iAmSmart.png';
import {useDispatch} from "react-redux"; import {useDispatch} from "react-redux";
import {handleLogin} from "auth/index"; import {handleLogin} from "auth/index";
import useJwt from "../../../auth/jwt/useJwt"; import useJwt from "../../../auth/jwt/useJwt";
import { handleLogoutFunction } from 'auth/index';
// ============================|| FIREBASE - LOGIN ||============================ // // ============================|| FIREBASE - LOGIN ||============================ //


const AuthLoginCustom = () => { const AuthLoginCustom = () => {
@@ -65,11 +65,12 @@ const AuthLoginCustom = () => {


const tryLogin = () => { const tryLogin = () => {
if(isValid){ if(isValid){
dispatch(handleLogoutFunction());
// setSumitting(true) // setSumitting(true)
useJwt useJwt
.login({username: values.username, password: values.password}) .login({username: values.username, password: values.password})
.then((response) => { .then((response) => {
// console.log("123")
console.log(response)
const userData = { const userData = {
id: response.data.id, id: response.data.id,
fullenName: response.data.name, fullenName: response.data.name,
@@ -92,7 +93,6 @@ const AuthLoginCustom = () => {
console.error(error.response.data.error) console.error(error.response.data.error)
setErrorMassage(error.response.data.error) setErrorMassage(error.response.data.error)
setOpen(true) setOpen(true)
console.log("321")
}); });
}else{ }else{
setOpen(true) setOpen(true)


Loading…
Cancel
Save