Răsfoiți Sursa

separated functions

kaori 5 ani în urmă
părinte
comite
227c2faf6d
1 a modificat fișierele cu 12 adăugiri și 8 ștergeri
  1. 12 8
      src/server/service/bolt.js

+ 12 - 8
src/server/service/bolt.js

@@ -63,7 +63,6 @@ class BoltService {
     };
 
     this.getSearchResultPaths = this.getSearchResultPaths.bind(this);
-    // this.updateOffsetNum = this.updateOffsetNum.bind(this);
     this.crowi = crowi;
     this.receiver = new BoltReciever();
 
@@ -130,12 +129,13 @@ class BoltService {
     });
 
     this.bolt.action('showNextResults', async({
-      body, ack, say, action,
+      body, ack, say, action, respond,
     }) => {
       await ack();
-      console.log('action.value', action.value);
+      console.log('respond', respond);
       const intOffset = parseInt(action.value);
-      const nextResults = this.getNextResults(intOffset);
+      const newOffsetNum = this.updateOffsetNum(intOffset);
+      const nextResults = this.getNextResults(newOffsetNum);
       console.log('nextResults', nextResults);
     });
 
@@ -160,14 +160,19 @@ class BoltService {
     throw new Error('/growi command: Invalid first argument');
   }
 
-  getNextResults = (offset) => {
+  updateOffsetNum = (offset) => {
     const newOffset = offset + 10;
     console.log('offset1', newOffset);
 
+    return newOffset;
+  };
+
+
+  getNextResults = () => {
     // this.getSearchResultPaths(command, args);
     // this.showEphemeralSearchResults();
+  }
 
-  };
 
   async getSearchResultPaths(command, args) {
     const firstKeyword = args[1];
@@ -279,8 +284,7 @@ class BoltService {
                   text: 'Next',
                 },
                 action_id: 'showNextResults',
-                value: `${offset}`
-                ,
+                value: `${offset}`,
               },
               {
                 type: 'button',