mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2026-01-23 08:00:22 +08:00
fix: 解决vite5循环引用导致热更新失效问题
This commit is contained in:
29
src/store/helper.js
Normal file
29
src/store/helper.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { basePermissions } from '@/settings'
|
||||
import api from '@/api'
|
||||
|
||||
export async function getUserInfo() {
|
||||
const res = await api.getUser()
|
||||
const { id, username, profile, roles, currentRole } = res.data || {}
|
||||
return {
|
||||
id,
|
||||
username,
|
||||
avatar: profile?.avatar,
|
||||
nickName: profile?.nickName,
|
||||
gender: profile?.gender,
|
||||
address: profile?.address,
|
||||
email: profile?.email,
|
||||
roles,
|
||||
currentRole,
|
||||
}
|
||||
}
|
||||
|
||||
export async function getPermissions() {
|
||||
let asyncPermissions = []
|
||||
try {
|
||||
const res = await api.getRolePermissions()
|
||||
asyncPermissions = res?.data || []
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
return basePermissions.concat(asyncPermissions)
|
||||
}
|
||||
Reference in New Issue
Block a user