Browse Source

Fix RecentCreated

Seiya Tashiro 7 years ago
parent
commit
df380afb4f

+ 13 - 0
src/client/js/components/RecentCreated/RecentCreated.js

@@ -20,8 +20,21 @@ export default class RecentCreated extends React.Component {
 
 
   componentWillMount() {
+    this.getRecentCreatedLimit();
     this.getRecentCreatedList(1);
   }
+  getRecentCreatedLimit() {
+    this.props.crowi.apiGet('/pages.recentCreated.limit', {})
+      .then(res => {
+        let limit = res.pages.showRecentCreatedNumber;
+        if (!limit) {
+          limit = 10;
+        }
+        this.setState({
+          limit,
+        });
+      });
+  }
   getRecentCreatedList(selectPageNumber) {
 
     const pageId = this.props.pageId;

+ 2 - 1
src/server/routes/admin.js

@@ -1387,9 +1387,10 @@ module.exports = function(crowi, app) {
   /**
    * Get Config.showRecentCreatedNumber and response result with json
    *
+   * @param {*} req
    * @param {*} res
    */
-  actions.api.showRecentCreatedNumber = async(res) => {
+  actions.api.showRecentCreatedNumber = function(req, res) {
     const config = crowi.getConfig();
 
     try {