Token無効の際再ログイン対応

This commit is contained in:
2023-11-09 13:47:21 +09:00
parent 0f154832a5
commit 4577df371a
5 changed files with 120 additions and 66 deletions

View File

@@ -1,8 +1,9 @@
import { defineStore } from 'pinia';
import { api } from 'boot/axios';
import { Router } from '../router';
import {IDomainInfo} from '../types/ActionTypes';
export interface IUserState{
token?:string;
returnUrl:string;
@@ -35,7 +36,7 @@ export const useAuthStore = defineStore({
api.defaults.headers["Authorization"]='Bearer ' + this.token;
this.currentDomain=await this.getCurrentDomain();
localStorage.setItem('currentDomain',JSON.stringify(this.currentDomain));
Router.push(this.returnUrl || '/');
this.router.push(this.returnUrl || '/');
return true;
}catch(e)
{