修改登录页

This commit is contained in:
GGJ
2023-12-26 09:51:16 +08:00
parent fea95de2da
commit ad034b4179
3 changed files with 95 additions and 80 deletions

View File

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