ryuichi-e 5 роки тому
батько
коміт
2a59c9f9d5
1 змінених файлів з 10 додано та 0 видалено
  1. 10 0
      src/server/routes/apiv3/share-links.js

+ 10 - 0
src/server/routes/apiv3/share-links.js

@@ -33,6 +33,16 @@ module.exports = (crowi) => {
 
 
   router.post('/', loginRequired, async(req, res) => {
   router.post('/', loginRequired, async(req, res) => {
     const { pageId, expiration, description } = req.body;
     const { pageId, expiration, description } = req.body;
+
+    try {
+      const postedShareLink = await ShareLink.create(pageId, expiration, description);
+      return res.apiv3(postedShareLink);
+    }
+    catch (err) {
+      const msg = 'Error occured in post share link';
+      logger.error('Error', err);
+      return res.apiv3Err(new ErrorV3(msg, 'post-shareLink-failed'));
+    }
   });
   });
 
 
   // TDOO write swagger
   // TDOO write swagger