|
@@ -42,6 +42,7 @@ export async function getInitialState(): Promise<{
|
|
|
try {
|
|
|
access_token = localStorage.getItem('access_token');
|
|
|
//if (!access_token) return; //随后去掉
|
|
|
+ //验证acces_token 获取用户数据
|
|
|
const res = await checkToken({ token: access_token });
|
|
|
var resUser = res.data;
|
|
|
} catch (err) {
|
|
@@ -61,7 +62,7 @@ export async function getInitialState(): Promise<{
|
|
|
|
|
|
const reFreshUser = async () => {
|
|
|
refresh_token = localStorage.getItem('refresh_token');
|
|
|
-
|
|
|
+ //刷新token 续约token
|
|
|
const res = await reFreshCheckToken({
|
|
|
zjfreshtoken: refresh_token,
|
|
|
});
|
|
@@ -73,10 +74,10 @@ export async function getInitialState(): Promise<{
|
|
|
//如果刷新token失败
|
|
|
//history.push(loginPath);
|
|
|
}
|
|
|
- //20分钟后再执行
|
|
|
+ //1分钟后再执行
|
|
|
setTimeout(() => {
|
|
|
reFreshUser();
|
|
|
- }, 1200000);
|
|
|
+ }, 60000);
|
|
|
};
|
|
|
|
|
|
await reFreshUser();
|