|
@@ -1,7 +1,7 @@
|
|
import router from '@/router'
|
|
import router from '@/router'
|
|
import config from '@/config/defaultSetting'
|
|
import config from '@/config/defaultSetting'
|
|
import { useRouterStore } from '@/stores/router'
|
|
import { useRouterStore } from '@/stores/router'
|
|
-import { getMenuList, login } from '@/api/user'
|
|
|
|
|
|
+import { getMenuList, login, getUserInfo } from '@/api/user'
|
|
|
|
|
|
export const useUserStore = defineStore({
|
|
export const useUserStore = defineStore({
|
|
id: 'user',
|
|
id: 'user',
|
|
@@ -15,8 +15,14 @@ export const useUserStore = defineStore({
|
|
}),
|
|
}),
|
|
actions: {
|
|
actions: {
|
|
async getUserInfo() {
|
|
async getUserInfo() {
|
|
- // const userRes: any = await getUserInfo()
|
|
|
|
- // this.user = userRes.infos[0]
|
|
|
|
|
|
+ try {
|
|
|
|
+ const userRes: any = await getUserInfo()
|
|
|
|
+ this.user = userRes.data.user
|
|
|
|
+ this.permission = userRes.data.permissions
|
|
|
|
+ this.permission && useStorage('permissionList', this.permission)
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error)
|
|
|
|
+ }
|
|
|
|
|
|
if (config.isDynamicRouter) {
|
|
if (config.isDynamicRouter) {
|
|
const res: any = await getMenuList()
|
|
const res: any = await getMenuList()
|