akira-s 5 лет назад
Родитель
Сommit
be0998b688

+ 12 - 10
src/client/js/components/Page/PageShareManagement.jsx

@@ -24,23 +24,25 @@ const PageShareManagement = (props) => {
     setIsOutsideShareLinkModalShown(false);
   }
 
-  function exportPageHundler(type) {
-    const exportPageFile = getExportPageFile(type);
-    exportPage(exportPageFile);
-  }
-  
+
   async function getExportPageFile(type) {
     const pageId = pageContainer.state.pageId;
     try {
-      const res = await appContainer.apiv3Get('/pages/export', {'page_id': pageId,'type': type});
+      const res = await appContainer.apiv3Get('/pages/export', { pageId, type });
       return res;
-    } catch(err) {
+    }
+    catch (err) {
       return null;
     }
   }
 
   function exportPage(exportPageFile) {
-    // export
+    // TODO implement
+  }
+
+  function exportPageHundler(type) {
+    const exportPageFile = getExportPageFile(type);
+    exportPage(exportPageFile);
   }
 
   function renderModals() {
@@ -94,10 +96,10 @@ const PageShareManagement = (props) => {
           <i className="icon-fw icon-link"></i>{t('Shere this page link to public')}
           <span className="ml-2 badge badge-info badge-pill">{pageContainer.state.shareLinksNumber}</span>
         </button>
-        <button type="button" className="dropdown-item" onClick={() => {exportPageHundler('markdown')}}>
+        <button type="button" className="dropdown-item" onClick={() => { exportPageHundler('markdown') }}>
           <span>Export page as Markdown</span>
         </button>
-        <button type="button" className="dropdown-item" onClick={() => {exportPageHundler('pdf')}}>
+        <button type="button" className="dropdown-item" onClick={() => { exportPageHundler('pdf') }}>
           <span>Export page as PDF</span>
         </button>
       </div>

+ 9 - 8
src/server/routes/apiv3/pages.js

@@ -84,19 +84,20 @@ module.exports = (crowi) => {
     }
   });
 
-  /** 
+  /**
   * @swagger
-  * 
+  *
   *    /pages/export:
   *      get:
-  *      tags: [Pages]
-  *      description: Get currently page file as md or pdf
-  *      responses:
-  *        200:
-  *          description: Return currently page file
+  *        tags: [Export]
+  *        description: get currently page file as md or pdf
+  *        responses:
+  *          200:
+  *            description: Return currently page file
   */
   router.get('/export', async(req, res) => {
-    return res.apiv3({});
+    // TODO use res.apiv3
+    return res.json({ ok: true });
   });
 
   return router;