diff --git a/src/api/plugin.ts b/src/api/plugin.ts index 2c71d1d..2ad7845 100644 --- a/src/api/plugin.ts +++ b/src/api/plugin.ts @@ -1,5 +1,7 @@ import axios from 'axios'; +const PrefixUriPlugin = 'api/v1/plugin/v1'; + export interface ServerPluginRoute { name: string; path: string; @@ -14,5 +16,7 @@ export interface GetSeverPluginRoutesResult { } export function getSeverPluginRoutes() { - return axios.get('/plugin/v1/frontend-routes'); + return axios.get( + `${PrefixUriPlugin}/frontend-routes`, + ); } diff --git a/src/router/routes/index.ts b/src/router/routes/index.ts index 5bf17c2..54e1dbf 100644 --- a/src/router/routes/index.ts +++ b/src/router/routes/index.ts @@ -87,7 +87,7 @@ export async function loadPluginRoutes(router: any) { router.getRoutes().find((route: any) => route.name === 'Plugin'), ); if (!pluginRoute) return; - if (!res.data.routes) return; + if (!res.data?.routes) return; pluginRoute.children = BuildPluginRoutes(res.data.routes as any) as any[]; router.removeRoute(pluginRoute.name as string);