itizawa 6 лет назад
Родитель
Сommit
ab2c7f3e16

+ 1 - 1
src/client/js/components/Admin/Notification/GlobalNotificationList.jsx

@@ -130,7 +130,7 @@ class GlobalNotificationList extends React.Component {
           isOpen={this.state.isConfirmationModalOpen}
           isOpen={this.state.isConfirmationModalOpen}
           onClose={this.closeConfirmationModal}
           onClose={this.closeConfirmationModal}
           onClickSubmit={this.onClickSubmit}
           onClickSubmit={this.onClickSubmit}
-        />;
+        />
       </React.Fragment>
       </React.Fragment>
     );
     );
 
 

+ 2 - 1
src/client/js/services/AdminNotificationContainer.js

@@ -118,7 +118,8 @@ export default class AdminNotificationContainer extends Container {
    * Delete global notification pattern
    * Delete global notification pattern
    */
    */
   async deleteGlobalNotificationPattern(notificatiionId) {
   async deleteGlobalNotificationPattern(notificatiionId) {
-    // TODO GW-780 create apiV3
+    await this.appContainer.apiv3.delete(`/notification-setting/global-notification/${notificatiionId}`);
+    return this.retrieveNotificationData();
   }
   }
 
 
 }
 }

+ 17 - 0
src/server/routes/apiv3/notification-setting.js

@@ -190,5 +190,22 @@ module.exports = (crowi) => {
 
 
   });
   });
 
 
+  // TODO Swagger Validation
+  router.delete('/global-notification/:id', loginRequiredStrictly, adminRequired, csrf, async(req, res) => {
+    const { id } = req.params;
+
+    try {
+      await GlobalNotificationSetting.findOneAndRemove({ _id: id });
+      return res.apiv3({});
+    }
+    catch (err) {
+      const msg = 'Error occurred in delete global notification';
+      logger.error('Error', err);
+      return res.apiv3Err(new ErrorV3(msg, 'delete-globalNotification-failed'));
+    }
+
+
+  });
+
   return router;
   return router;
 };
 };