From 11a5c568c30f1059b1fbbef2ade261f31abe84d7 Mon Sep 17 00:00:00 2001 From: xion Date: Mon, 24 Jun 2024 00:51:16 +0800 Subject: [PATCH] feat: add byid --- src/admin/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/admin/index.ts b/src/admin/index.ts index 78783fe..f0e08f4 100644 --- a/src/admin/index.ts +++ b/src/admin/index.ts @@ -14,7 +14,6 @@ getRouterList.run = async (ctx) => { router.add(getRouterList); // remove router - export const removeRouter = new Route('admin', 'removeRouter'); removeRouter.run = async (ctx) => { const { path, key } = ctx.query; @@ -24,6 +23,16 @@ removeRouter.run = async (ctx) => { } router.add(removeRouter); +// remove router by id +export const removeRouterById = new Route('admin', 'removeRouterById'); +removeRouterById.run = async (ctx) => { + const { id } = ctx.query; + router.removeById(id); + ctx.body = 'success'; + return ctx; +} +router.add(removeRouterById); + // add router export const addRouter = new Route('admin', 'addRouter');