角色列表添加
This commit is contained in:
@@ -5,14 +5,18 @@ import type { AdminInfo } from '@/stores/interface'
|
||||
export const useAdminInfo = defineStore('adminInfo', {
|
||||
state: (): AdminInfo => {
|
||||
return {
|
||||
id: 0,
|
||||
username: '',
|
||||
nickname: '',
|
||||
avatar: '',
|
||||
last_login_time: '',
|
||||
token: '',
|
||||
access_token: '',
|
||||
token_type: '',
|
||||
refresh_token: '',
|
||||
super: false
|
||||
expires_in: 0,
|
||||
scope: '',
|
||||
nickname: '',
|
||||
userType: 1,
|
||||
deptIndex: '',
|
||||
userIndex: '',
|
||||
client_id: '',
|
||||
headSculpture: '',
|
||||
jti: ''
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@@ -20,7 +24,7 @@ export const useAdminInfo = defineStore('adminInfo', {
|
||||
this.$state = { ...this.$state, ...state }
|
||||
},
|
||||
removeToken() {
|
||||
this.token = ''
|
||||
this.access_token = ''
|
||||
this.refresh_token = ''
|
||||
},
|
||||
setToken(token: string, type: 'auth' | 'refresh') {
|
||||
@@ -28,7 +32,7 @@ export const useAdminInfo = defineStore('adminInfo', {
|
||||
this[field] = token
|
||||
},
|
||||
getToken(type: 'auth' | 'refresh' = 'auth') {
|
||||
return type === 'auth' ? this.token : this.refresh_token
|
||||
return type === 'auth' ? this.token_type + ' ' + this.access_token : this.refresh_token
|
||||
}
|
||||
},
|
||||
persist: {
|
||||
|
||||
Reference in New Issue
Block a user