From 4e9720313061115c6db5ab4f58a78cb212b31747 Mon Sep 17 00:00:00 2001 From: Matrix-X Date: Wed, 18 Oct 2023 18:02:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dplugin=E7=9A=84=E8=B7=AF?= =?UTF-8?q?=E5=BE=84Uri?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/plugin.ts | 6 +++++- src/router/routes/index.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) 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);