Skip to content

Commit

Permalink
修复plugin的路径Uri
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrix-X committed Oct 18, 2023
1 parent 790f729 commit 4e97203
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/api/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import axios from 'axios';

const PrefixUriPlugin = 'api/v1/plugin/v1';

export interface ServerPluginRoute {
name: string;
path: string;
Expand All @@ -14,5 +16,7 @@ export interface GetSeverPluginRoutesResult {
}

export function getSeverPluginRoutes() {
return axios.get<GetSeverPluginRoutesResult>('/plugin/v1/frontend-routes');
return axios.get<GetSeverPluginRoutesResult>(
`${PrefixUriPlugin}/frontend-routes`,
);
}
2 changes: 1 addition & 1 deletion src/router/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4e97203

Please sign in to comment.