You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2022/07/07 09:37:15 UTC

[apisix-dashboard] branch master updated: fix: duplicate ID (#2501)

This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 5f44089e fix: duplicate ID (#2501)
5f44089e is described below

commit 5f44089e917a909c2cada32c599b63072801522f
Author: Young <is...@outlook.com>
AuthorDate: Thu Jul 7 17:37:10 2022 +0800

    fix: duplicate ID (#2501)
---
 web/src/pages/Route/Create.tsx  | 8 +++++++-
 web/src/pages/Route/typing.d.ts | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/web/src/pages/Route/Create.tsx b/web/src/pages/Route/Create.tsx
index fe7458ca..77c74a1f 100644
--- a/web/src/pages/Route/Create.tsx
+++ b/web/src/pages/Route/Create.tsx
@@ -234,11 +234,17 @@ const Page: React.FC<Props> = (props) => {
         step3Data,
         advancedMatchingRules,
       } as RouteModule.RequestData;
-      if (props.route.path.indexOf('edit') !== -1) {
+
+      const { path } = props.route
+
+      if (path.indexOf('edit') !== -1) {
         update((props as any).match.params.rid, routeData).then(() => {
           setStep(5);
         });
       } else {
+        if (path.indexOf('duplicate') !== -1) {
+          delete routeData.form1Data.id
+        }
         create(routeData).then(() => {
           setStep(5);
         });
diff --git a/web/src/pages/Route/typing.d.ts b/web/src/pages/Route/typing.d.ts
index 42dcefeb..64c4bb72 100644
--- a/web/src/pages/Route/typing.d.ts
+++ b/web/src/pages/Route/typing.d.ts
@@ -115,6 +115,7 @@ declare namespace RouteModule {
   };
 
   type Form1Data = {
+    id?: string;
     name: string;
     desc: string;
     custom_version_label: string;