Explorar el Código

create endpoint

Shun Miyazawa hace 4 años
padre
commit
5968db47ed
Se han modificado 1 ficheros con 16 adiciones y 0 borrados
  1. 16 0
      packages/app/src/server/routes/apiv3/page.js

+ 16 - 0
packages/app/src/server/routes/apiv3/page.js

@@ -463,5 +463,21 @@ module.exports = (crowi) => {
   //   return res.apiv3({ dummy });
   // });
 
+  router.put('/subscribe', accessTokenParser, loginRequiredStrictly, csrf, async(req, res) => {
+    console.log('ok');
+    return res.apiv3({});
+    // const { page_id: pageId } = req.body
+    // const { _id: userId } = req.user as UserDocument
+    // const status = req.body.status ? Watcher.STATUS_WATCH : Watcher.STATUS_IGNORE
+    // try {
+    //   const watcher = await Watcher.watchByPageId(userId, pageId, status)
+    //   const result = { watcher }
+    //   return res.json(ApiResponse.success(result))
+    // } catch (err) {
+    //   debug('Error occured while update watch status', err, err.stack)
+    //   return res.json(ApiResponse.error('Failed to watch this page.'))
+    // }
+  });
+
   return router;
 };