mirror of
https://github.com/SOR2171/Springboot4-Vue3_Demo.git
synced 2026-10-23 19:41:12 +08:00
fix: relogin
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export interface JwtAuth {
|
||||
token: string;
|
||||
expire: number;
|
||||
expire: string;
|
||||
}
|
||||
|
||||
export interface ApiResponse<T = any> {
|
||||
@@ -11,7 +11,7 @@ export interface ApiResponse<T = any> {
|
||||
|
||||
export interface LoginResponse {
|
||||
token: string;
|
||||
expire: number;
|
||||
expire: string;
|
||||
username: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ function takeAccessToken(): string | null {
|
||||
|
||||
try {
|
||||
const authObject: JwtAuth = JSON.parse(str);
|
||||
if (authObject.expire < Date.now()) {
|
||||
if (new Date(authObject.expire).getTime() < Date.now()) {
|
||||
deleteAccessToken();
|
||||
ElMessage.warning('Your session has expired, please log in again.');
|
||||
return null;
|
||||
@@ -22,7 +22,7 @@ function takeAccessToken(): string | null {
|
||||
}
|
||||
}
|
||||
|
||||
function storeAccessToken(token: string, remember: boolean, expire: number): void {
|
||||
function storeAccessToken(token: string, remember: boolean, expire: string): void {
|
||||
const authObject: JwtAuth = {
|
||||
token: token,
|
||||
expire: expire
|
||||
|
||||
Reference in New Issue
Block a user