reiji-h 2 лет назад
Родитель
Сommit
e350123734

+ 1 - 3
apps/app/src/components/PageEditor/PageEditor.tsx

@@ -308,12 +308,10 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
     files.forEach(async(file) => {
       try {
         // eslint-disable-next-line @typescript-eslint/no-explicit-any
-        const resLimit: any = await apiv3Get('/attachments.limit', {
+        const { data: resLimit }: any = await apiv3Get('/attachment/limit', {
           fileSize: file.size,
         });
 
-        console.log(resLimit);
-
         if (!resLimit.isUploadable) {
           throw new Error(resLimit.errorMessage);
         }

+ 9 - 9
apps/app/src/server/routes/apiv3/attachment.js

@@ -138,11 +138,11 @@ module.exports = (crowi) => {
   /**
    * @swagger
    *
-   *    /attachments/limit:
+   *    /attachment/limit:
    *      get:
-   *        tags: [Attachments]
-   *        operationId: getAttachmentsLimit
-   *        summary: /attachments/limit
+   *        tags: [Attachment]
+   *        operationId: getAttachmentLimit
+   *        summary: /attachment/limit
    *        description: Get available capacity of uploaded file with GridFS
    *        parameters:
    *          - in: query
@@ -169,15 +169,15 @@ module.exports = (crowi) => {
    *            $ref: '#/components/responses/500'
    */
   /**
-   * @api {get} /attachments/limit get available capacity of uploaded file with GridFS
-   * @apiName AddAttachments
+   * @api {get} /attachment/limit get available capacity of uploaded file with GridFS
+   * @apiName AddAttachment
    * @apiGroup Attachment
    */
-  router.get('/limit', accessTokenParser, loginRequired, validator.retrieveAttachments, apiV3FormValidator, async(req, res) => {
+  router.get('/limit', accessTokenParser, loginRequired, apiV3FormValidator, async(req, res) => {
     const { fileUploadService } = crowi;
     const fileSize = Number(req.query.fileSize);
-    const resLimit = await fileUploadService.checkLimit(fileSize);
-    return res.apiv3({ resLimit });
+    return res.apiv3(await fileUploadService.checkLimit(fileSize));
   });
+
   return router;
 };