修改计划列表和增加刷新后读取用户信息

release
Jimmy Liow 2 years ago
parent 962de1e246
commit ec27fb6732

@ -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();

@ -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");

@ -49,14 +49,14 @@ function Newest() {
if (reservation.guide === '') {
return (
<Space size="middle">
<Button type="link" onClick={() => showCityGuideModal(reservation)}>Fill in</Button>
<Button type="link" onClick={() => showCityGuideModal(reservation)}>Add</Button>
</Space>
);
} else {
return (
<Space size="middle">
<span>{reservation.guide}</span>
<Button type="link" onClick={() => showCityGuideModal(reservation)}>Modify</Button>
<Button type="link" onClick={() => showCityGuideModal(reservation)}>Edit</Button>
</Space>
);
}
@ -107,7 +107,7 @@ function Newest() {
onSearchClick(1, 1);
}
return () => {
console.info('unmount...');
// unmount...
};
}, []);

Loading…
Cancel
Save