pre: 代码优化

This commit is contained in:
honorsuper
2022-09-23 09:28:58 +08:00
parent 9ba51e4a34
commit 026e4c1acd

View File

@@ -1,10 +1,8 @@
import { defineStore } from 'pinia';
import { createStorage } from '@/utils/Storage';
import { store } from '@/store';
import { ACCESS_TOKEN, CURRENT_USER, IS_LOCKSCREEN } from '@/store/mutation-types';
import { ResultEnum } from '@/enums/httpEnum';
const Storage = createStorage({ storage: localStorage });
import { getUserInfo, login } from '@/api/system/user';
import { storage } from '@/utils/Storage';
@@ -20,12 +18,12 @@ export interface IUserState {
export const useUserStore = defineStore({
id: 'app-user',
state: (): IUserState => ({
token: Storage.get(ACCESS_TOKEN, ''),
token: storage.get(ACCESS_TOKEN, ''),
username: '',
welcome: '',
avatar: '',
permissions: [],
info: Storage.get(CURRENT_USER, {}),
info: storage.get(CURRENT_USER, {}),
}),
getters: {
getToken(): string {