权限问题修改
This commit is contained in:
@@ -130,7 +130,6 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
||||
|
||||
async function loginByToken(loginToken: Api.Auth.LoginToken) {
|
||||
// 1. stored in the localStorage, the later requests need it in headers
|
||||
localStg.set('userInfo', loginToken);
|
||||
localStg.set('token', loginToken.token);
|
||||
|
||||
// 2. get user info
|
||||
@@ -149,6 +148,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
||||
const { data: info, error } = await fetchGetUserInfo();
|
||||
|
||||
if (!error) {
|
||||
localStg.set('userInfo', info);
|
||||
// update store
|
||||
Object.assign(userInfo, info);
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
|
||||
/** Init static auth route */
|
||||
function initStaticAuthRoute() {
|
||||
const { authRoutes: staticAuthRoutes } = createStaticRoutes();
|
||||
const filteredRoutes = filterRoutesByPaths(staticAuthRoutes, localStg.get('userInfo').perms);
|
||||
const filteredRoutes = filterRoutesByPaths(staticAuthRoutes, localStg.get('userInfo')?.perms);
|
||||
if (authStore.isStaticSuper) {
|
||||
addAuthRoutes(filteredRoutes);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user