Sfoglia il codice sorgente

when the dropdown is opened, it becomes mark as read

Shun Miyazawa 4 anni fa
parent
commit
5e21f8e50d

+ 2 - 2
packages/app/src/components/InAppNotification/InAppNotificationDropdown.tsx

@@ -45,9 +45,9 @@ const InAppNotificationDropdown: FC<Props> = (props: Props) => {
     });
   };
 
-  const updateNotificationStatus = () => {
+  const updateNotificationStatus = async() => {
     try {
-      // await this.props.crowi.apiPost('/notification.read');
+      await appContainer.apiv3Post('/in-app-notification/read');
       setCount(0);
     }
     catch (err) {

+ 2 - 2
packages/app/src/server/routes/apiv3/in-app-notification.ts

@@ -43,11 +43,11 @@ module.exports = (crowi) => {
     }
   });
 
-  router.post('/read', accessTokenParser, loginRequiredStrictly, csrf, (req, res) => {
+  router.post('/read', accessTokenParser, loginRequiredStrictly, csrf, async(req, res) => {
     const user = req.user;
 
     try {
-      const notification = InAppNotification.read(user);
+      const notification = await inAppNotificationService.read(user);
       const result = { notification };
       return res.apiv3(result);
     }