From ec27fb6732653e7bd6dc0ea5828d142b4495ef47 Mon Sep 17 00:00:00 2001
From: Jimmy Liow <18777396951@163.com>
Date: Thu, 25 May 2023 10:28:02 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A1=E5=88=92=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=E5=92=8C=E5=A2=9E=E5=8A=A0=E5=88=B7=E6=96=B0=E5=90=8E?=
=?UTF-8?q?=E8=AF=BB=E5=8F=96=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/stores/Auth.js | 7 +++++--
src/views/Login.jsx | 2 +-
src/views/reservation/Newest.jsx | 6 +++---
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/stores/Auth.js b/src/stores/Auth.js
index 5a0942f..a564fec 100644
--- a/src/stores/Auth.js
+++ b/src/stores/Auth.js
@@ -1,7 +1,7 @@
import { makeAutoObservable, runInAction } from "mobx";
import { fetchJSON, postForm } from '@/utils/request';
import { HT_HOST } from "@/config";
-import { prepareUrl } from '@/utils/commons';
+import { isNotEmpty, prepareUrl } from '@/utils/commons';
const KEY_LOGIN_TOKEN = 'KEY_LOGIN_TOKEN';
@@ -11,6 +11,9 @@ class Auth {
makeAutoObservable(this, { rootStore: false });
this.root = root;
this.login.token = root.getSession(KEY_LOGIN_TOKEN);
+ if (isNotEmpty(this.login.token)) {
+ this.fetchUserDetail();
+ }
setInterval(() => {
// console.info('Auth.check.token.');
}, 10000);
@@ -34,7 +37,7 @@ class Auth {
});
}
- fetchUserDetail(userId) {
+ fetchUserDetail() {
const fetchUrl = prepareUrl(HT_HOST + '/service-CooperateSOA/GetLinkManInfo')
.append('token', this.login.token)
.build();
diff --git a/src/views/Login.jsx b/src/views/Login.jsx
index 8551568..92509de 100644
--- a/src/views/Login.jsx
+++ b/src/views/Login.jsx
@@ -14,7 +14,7 @@ function Login() {
authStore.valdateUserPassword(values.username, values.password)
.then((userId) => {
noticeStore.getBulletinUnReadCount(userId);
- authStore.fetchUserDetail(userId)
+ authStore.fetchUserDetail()
.then((user) => {
// navigate(-1) is equivalent to hitting the back button.
navigate("/reservation/newest");
diff --git a/src/views/reservation/Newest.jsx b/src/views/reservation/Newest.jsx
index 3e25ed2..2a485b2 100644
--- a/src/views/reservation/Newest.jsx
+++ b/src/views/reservation/Newest.jsx
@@ -49,14 +49,14 @@ function Newest() {
if (reservation.guide === '') {
return (
-
+
);
} else {
return (
{reservation.guide}
-
+
);
}
@@ -107,7 +107,7 @@ function Newest() {
onSearchClick(1, 1);
}
return () => {
- console.info('unmount...');
+ // unmount...
};
}, []);