获取token修改

This commit is contained in:
仲么了
2024-01-22 10:31:07 +08:00
parent ac96d0365a
commit 08e0e9e013
6 changed files with 138 additions and 26 deletions

View File

@@ -32,7 +32,15 @@ export const useAdminInfo = defineStore('adminInfo', {
this[field] = token
},
getToken(type: 'auth' | 'refresh' = 'auth') {
return type === 'auth' ? this.token_type + ' ' + this.access_token : this.refresh_token
if (type === 'auth') {
if (this.token_type && this.access_token) {
return this.token_type + ' ' + this.access_token
} else {
return ''
}
} else {
return this.refresh_token
}
}
},
persist: {