فهرست منبع

Fix RecentCreated

Seiya Tashiro 7 سال پیش
والد
کامیت
df380afb4f
2فایلهای تغییر یافته به همراه15 افزوده شده و 1 حذف شده
  1. 13 0
      src/client/js/components/RecentCreated/RecentCreated.js
  2. 2 1
      src/server/routes/admin.js

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

@@ -20,8 +20,21 @@ export default class RecentCreated extends React.Component {
 
 
 
 
   componentWillMount() {
   componentWillMount() {
+    this.getRecentCreatedLimit();
     this.getRecentCreatedList(1);
     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) {
   getRecentCreatedList(selectPageNumber) {
 
 
     const pageId = this.props.pageId;
     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
    * Get Config.showRecentCreatedNumber and response result with json
    *
    *
+   * @param {*} req
    * @param {*} res
    * @param {*} res
    */
    */
-  actions.api.showRecentCreatedNumber = async(res) => {
+  actions.api.showRecentCreatedNumber = function(req, res) {
     const config = crowi.getConfig();
     const config = crowi.getConfig();
 
 
     try {
     try {