token修改

This commit is contained in:
仲么了
2024-01-03 14:04:56 +08:00
parent 8e2569010f
commit 25a8c99088
5 changed files with 20 additions and 22 deletions

View File

@@ -10,7 +10,7 @@ export const useAdminInfo = defineStore('adminInfo', {
nickname: '',
avatar: '',
last_login_time: '',
token: localStorage.getItem('token') || '',
token: '',
refresh_token: '',
super: false
}
@@ -26,7 +26,6 @@ export const useAdminInfo = defineStore('adminInfo', {
setToken(token: string, type: 'auth' | 'refresh') {
const field = type == 'auth' ? 'token' : 'refresh_token'
this[field] = token
window.localStorage.setItem(field, token)
},
getToken(type: 'auth' | 'refresh' = 'auth') {
return type === 'auth' ? this.token : this.refresh_token