Merge pull request #179 from honorsuper/patch-4

pre: 代码优化
This commit is contained in:
Ah jung
2022-09-24 09:04:29 +08:00
committed by GitHub

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 {