2
0
Эх сурвалжийг харах

use isTrashPage from path-utils

kaori 5 жил өмнө
parent
commit
5455fd5208

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

@@ -89,15 +89,13 @@ module.exports = (crowi) => {
     const limit = +req.query.limit || 30;
     const limit = +req.query.limit || 30;
     const offset = +req.query.offset || 0;
     const offset = +req.query.offset || 0;
 
 
-    let includeTrashed;
-    if (path === '/trash') {
-      includeTrashed = true;
-    }
-    else {
-      includeTrashed = false;
-    }
+    const { isTrashPage } = require('@commons/util/path-utils');
 
 
-    const queryOptions = { offset, limit, includeTrashed };
+    const queryOptions = {
+      offset,
+      limit,
+      includeTrashed: isTrashPage,
+    };
 
 
     try {
     try {
       const result = await Page.findListWithDescendants(path, req.user, queryOptions);
       const result = await Page.findListWithDescendants(path, req.user, queryOptions);