fix: hide unsupported menus in minimal scope
This commit is contained in:
+20
-1
@@ -1,4 +1,5 @@
|
||||
import { apiRequest } from "../axios-client";
|
||||
import { normalizeHomeTargetPath } from '~/config/minimal-scope';
|
||||
// import dayjs from 'dayjs';
|
||||
|
||||
/**
|
||||
@@ -257,7 +258,25 @@ export async function getEntryModules(token?: string): Promise<EntryModule[]> {
|
||||
return [];
|
||||
}
|
||||
|
||||
return modules;
|
||||
const normalizedModules: EntryModule[] = [];
|
||||
for (const module of modules) {
|
||||
const normalizedTargetPath = normalizeHomeTargetPath(
|
||||
module.targetPath,
|
||||
Array.isArray(module.documentTypes) && module.documentTypes.length > 0
|
||||
);
|
||||
|
||||
if (!normalizedTargetPath) {
|
||||
continue;
|
||||
}
|
||||
|
||||
normalizedModules.push({
|
||||
...module,
|
||||
targetPath: normalizedTargetPath,
|
||||
routePath: normalizedTargetPath
|
||||
});
|
||||
}
|
||||
|
||||
return normalizedModules;
|
||||
} catch (error) {
|
||||
console.error('❌ [getEntryModules] 获取入口模块失败:', error instanceof Error ? error.message : String(error));
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user