瀏覽代碼

update user loggin

master
Alex Cheung 1 年之前
父節點
當前提交
1a361a5948
共有 2 個檔案被更改,包括 4 行新增4 行删除
  1. +1
    -1
      src/auth/index.js
  2. +3
    -3
      src/pages/authentication/auth-forms/AuthLoginCustom.js

+ 1
- 1
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')


+ 3
- 3
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)


Loading…
取消
儲存