bzp2010 commented on code in PR #2480:
URL: https://github.com/apache/apisix-dashboard/pull/2480#discussion_r905747065


##########
web/src/pages/Route/components/DataLoader/Import.tsx:
##########
@@ -103,18 +103,20 @@ const DataLoaderImport: React.FC<Props> = (props) => {
     });
     formData.append('file', uploadFileList[0]);
 
-    importRoutes(formData).then((r) => {
-      let errorNumber = 0;
-      entityNames.forEach((v) => {
-        errorNumber += r.data[v].failed;
-      });
+    importRoutes(formData)
+      .then((r) => {
+        let errorNumber = 0;
+        entityNames.forEach((v) => {
+          errorNumber += r.data[v].failed;
+        });
 
-      setImportResult({
-        success: errorNumber <= 0,
-        data: r.data,
-      });
-      setState('result');
-    });
+        setImportResult({
+          success: errorNumber <= 0,
+          data: r.data,
+        });
+        setState('result');
+      })
+      .catch(console.error);

Review Comment:
   That probably means we don't need to catch and just keep an empty catch 
function.



##########
web/src/pages/Route/components/DataLoader/Import.tsx:
##########
@@ -103,18 +103,20 @@ const DataLoaderImport: React.FC<Props> = (props) => {
     });
     formData.append('file', uploadFileList[0]);
 
-    importRoutes(formData).then((r) => {
-      let errorNumber = 0;
-      entityNames.forEach((v) => {
-        errorNumber += r.data[v].failed;
-      });
+    importRoutes(formData)
+      .then((r) => {
+        let errorNumber = 0;
+        entityNames.forEach((v) => {
+          errorNumber += r.data[v].failed;
+        });
 
-      setImportResult({
-        success: errorNumber <= 0,
-        data: r.data,
-      });
-      setState('result');
-    });
+        setImportResult({
+          success: errorNumber <= 0,
+          data: r.data,
+        });
+        setState('result');
+      })
+      .catch(console.error);

Review Comment:
   That probably means we don't need to catch and just keep an empty catch 
function. 🤔



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to