Просмотр исходного кода

refactor: fix small issues

- use index as array key
- rm unnecessary try catch
mizozobu 3 лет назад
Родитель
Сommit
95c3bac7a7

+ 3 - 4
packages/app/src/components/Admin/G2GDataTransferExportForm.tsx

@@ -143,9 +143,8 @@ const G2GDataTransferExportForm = (props: Props): JSX.Element => {
     return (
       <div className="alert alert-warning">
         <ul>
-          {errors.map((error) => {
-            // eslint-disable-next-line react/no-array-index-key
-            return <li key={error}>{error}</li>;
+          {errors.map((error, i) => {
+            return <li key={i}>{error}</li>;
           })}
         </ul>
       </div>
@@ -165,7 +164,7 @@ const G2GDataTransferExportForm = (props: Props): JSX.Element => {
       <div className="mt-4">
         <legend>{groupName} Collections</legend>
         <ImportItems collectionNames={collectionNames} />
-        <WarnForGroups errors={errors} key={`warnFor${groupName}`} />
+        <WarnForGroups errors={errors} />
       </div>
     );
   };

+ 3 - 8
packages/app/src/server/routes/apiv3/g2g-transfer.ts

@@ -318,14 +318,9 @@ module.exports = (crowi: Crowi): Router => {
     }
 
     // Start transfer
-    try {
-      // DO NOT "await". Let it run in the background.
-      // Errors should be emitted through websocket.
-      g2gTransferPusherService.startTransfer(tk, req.user, collections, optionsMap);
-    }
-    catch (err) {
-      logger.error(err);
-    }
+    // DO NOT "await". Let it run in the background.
+    // Errors should be emitted through websocket.
+    g2gTransferPusherService.startTransfer(tk, req.user, collections, optionsMap);
 
     return res.apiv3({ message: 'Successfully requested auto transfer.' });
   });