import { useQuery } from 'umi'; export interface IRoute { name?: string; redirect?: string; path: string; id: string; parentId?: string; file?: string; absPath: string; isLayout?: boolean; } export interface IPlugin { key: string; time: { register: number; hooks: Record; }; } export interface IImportGraph { inputs: Record; } export interface IAppData { plugins?: Record; userConfig?: Record; config?: Record; routes?: Record; prepare?: { buildResult: { metafile?: IImportGraph }; }; ui?: { modules: { name: string; menus?: { path: string; url: string; icon: string; name: string; }[]; }[]; }; } export function useAppData() { return useQuery(['appData'], { queryFn() { return fetch('/__umi/api/app-data').then((res) => res.json()); }, }); }