Selaa lähdekoodia

Merge branch 'release/v1.2.4' of npm/comment into master

AdamFu 4 vuotta sitten
vanhempi
commit
bc184d0c18
8 muutettua tiedostoa jossa 41 lisäystä ja 29 poistoa
  1. 10
    4
      lib/App.js
  2. 1
    1
      lib/App.js.map
  3. 4
    4
      lib/index.js
  4. 1
    1
      lib/index.js.map
  5. 5
    5
      lib/version.json
  6. 1
    1
      package.json
  7. 15
    9
      src/App.js
  8. 4
    4
      src/index.js

+ 10
- 4
lib/App.js Näytä tiedosto

@@ -433,7 +433,7 @@ var App = function (_Component) {
433 433
         _this6.setState({ list: list, total: total + 1 });
434 434
         _this6.props.onCountChange(total + 1);
435 435
       }).catch(function (error) {
436
-        _this6.props.onCommentFail(error.response.status);
436
+        _this6.props.onCommentFail(error.response.status, error.response.data);
437 437
         _this6.errorHandler(error);
438 438
       }).finally(function () {
439 439
         _this6.handleChangeLoading("sCreateComment", false);
@@ -508,7 +508,10 @@ var App = function (_Component) {
508 508
         });
509 509
         _this8.props.onUpdateComment("comment");
510 510
         _this8.setState({ list: list });
511
-      }).catch(this.errorHandler).finally(function () {
511
+      }).catch(function (error) {
512
+        _this8.props.onCommentFail(error.response.status, error.response.data);
513
+        _this8.errorHandler(error);
514
+      }).finally(function () {
512 515
         _this8.handleChangeLoading("sUpdateComment", false);
513 516
       });
514 517
     }
@@ -551,7 +554,7 @@ var App = function (_Component) {
551 554
         });
552 555
         _this9.setState({ list: list });
553 556
       }).catch(function (error) {
554
-        _this9.props.onCommentFail(error.response.status);
557
+        _this9.props.onCommentFail(error.response.status, error.response.data);
555 558
         _this9.errorHandler(error);
556 559
       }).finally(function () {
557 560
         _this9.handleChangeLoading("sCreateReply", false);
@@ -627,7 +630,10 @@ var App = function (_Component) {
627 630
           _this11.sGetReply({ commentId: commentId, page: i });
628 631
         }
629 632
         _this11.props.onUpdateComment("reply");
630
-      }).catch(this.errorHandler).finally(function () {
633
+      }).catch(function (error) {
634
+        _this11.props.onCommentFail(error.response.status, error.response.data);
635
+        _this11.errorHandler(error);
636
+      }).finally(function () {
631 637
         _this11.handleChangeLoading("sUpdateReply", false);
632 638
       });
633 639
     }

+ 1
- 1
lib/App.js.map
File diff suppressed because it is too large
Näytä tiedosto


+ 4
- 4
lib/index.js Näytä tiedosto

@@ -125,9 +125,9 @@ if (process.env.NODE_ENV !== "production") {
125 125
     type: 3,
126 126
     businessId: "5ea8320dedd68200018e733d",
127 127
     businessUserId: 4,
128
-    userId: 58297,
128
+    userId: 45,
129 129
     currentUser: {
130
-      user_id: 58297
130
+      user_id: 45
131 131
     },
132 132
     userAvaHoverData: {
133 133
       71763: {
@@ -181,8 +181,8 @@ if (process.env.NODE_ENV !== "production") {
181 181
     onDelete: function onDelete(type, data) {
182 182
       console.log(type, data);
183 183
     },
184
-    onCommentFail: function onCommentFail(data) {
185
-      console.log("onCommentFail", data);
184
+    onCommentFail: function onCommentFail(status, data) {
185
+      console.log("onCommentFail", status, data);
186 186
     },
187 187
     onUpdateComment: function onUpdateComment(type, data) {
188 188
       console.log("onUpdateComment", type);

+ 1
- 1
lib/index.js.map
File diff suppressed because it is too large
Näytä tiedosto


+ 5
- 5
lib/version.json Näytä tiedosto

@@ -1,8 +1,8 @@
1 1
 {
2 2
     "name":       "comment",
3
-    "buildDate":  1604757339795,
4
-    "version":    "1.0.4",
5
-    "numCommits": 219,
6
-    "hash":       "1e52141",
7
-    "dirty":      false
3
+    "buildDate":  1604847384031,
4
+    "version":    "1.2.4",
5
+    "numCommits": 225,
6
+    "hash":       "1377102",
7
+    "dirty":      true
8 8
 }

+ 1
- 1
package.json Näytä tiedosto

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "comment",
3
-  "version": "1.2.3",
3
+  "version": "1.2.4",
4 4
   "main": "lib/App.js",
5 5
   "description": "通用评论",
6 6
   "keywords": [

+ 15
- 9
src/App.js Näytä tiedosto

@@ -60,9 +60,9 @@ class App extends Component {
60 60
     this.axios = axios;
61 61
     this.axios.defaults.withCredentials = true;
62 62
     if (this.props.token) {
63
-      this.axios.defaults.headers.common[
64
-        "Authorization"
65
-      ] = `Bearer ${this.props.token}`;
63
+      this.axios.defaults.headers.common["Authorization"] = `Bearer ${
64
+        this.props.token
65
+      }`;
66 66
     }
67 67
   }
68 68
 
@@ -137,8 +137,8 @@ class App extends Component {
137 137
       action: content.replies
138 138
         ? "comment"
139 139
         : content.reply
140
-        ? "replyToReply"
141
-        : "reply",
140
+          ? "replyToReply"
141
+          : "reply",
142 142
       replyId,
143 143
       commentId,
144 144
       userId,
@@ -311,7 +311,7 @@ class App extends Component {
311 311
         this.props.onCountChange(total + 1);
312 312
       })
313 313
       .catch(error => {
314
-        this.props.onCommentFail(error.response.status);
314
+        this.props.onCommentFail(error.response.status, error.response.data);
315 315
         this.errorHandler(error);
316 316
       })
317 317
       .finally(() => {
@@ -370,7 +370,10 @@ class App extends Component {
370 370
         this.props.onUpdateComment("comment");
371 371
         this.setState({ list });
372 372
       })
373
-      .catch(this.errorHandler)
373
+      .catch(error => {
374
+        this.props.onCommentFail(error.response.status, error.response.data);
375
+        this.errorHandler(error);
376
+      })
374 377
       .finally(() => {
375 378
         this.handleChangeLoading("sUpdateComment", false);
376 379
       });
@@ -411,7 +414,7 @@ class App extends Component {
411 414
         this.setState({ list });
412 415
       })
413 416
       .catch(error => {
414
-        this.props.onCommentFail(error.response.status);
417
+        this.props.onCommentFail(error.response.status, error.response.data);
415 418
         this.errorHandler(error);
416 419
       })
417 420
       .finally(() => {
@@ -472,7 +475,10 @@ class App extends Component {
472 475
         }
473 476
         this.props.onUpdateComment("reply");
474 477
       })
475
-      .catch(this.errorHandler)
478
+      .catch(error => {
479
+        this.props.onCommentFail(error.response.status, error.response.data);
480
+        this.errorHandler(error);
481
+      })
476 482
       .finally(() => {
477 483
         this.handleChangeLoading("sUpdateReply", false);
478 484
       });

+ 4
- 4
src/index.js Näytä tiedosto

@@ -90,9 +90,9 @@ if (process.env.NODE_ENV !== "production") {
90 90
     type: 3,
91 91
     businessId: "5ea8320dedd68200018e733d",
92 92
     businessUserId: 4,
93
-    userId: 58297,
93
+    userId: 45,
94 94
     currentUser: {
95
-      user_id: 58297
95
+      user_id: 45
96 96
     },
97 97
     userAvaHoverData: {
98 98
       71763: {
@@ -146,8 +146,8 @@ if (process.env.NODE_ENV !== "production") {
146 146
     onDelete: (type, data) => {
147 147
       console.log(type, data);
148 148
     },
149
-    onCommentFail: data => {
150
-      console.log("onCommentFail", data);
149
+    onCommentFail: (status, data) => {
150
+      console.log("onCommentFail", status, data);
151 151
     },
152 152
     onUpdateComment: (type, data) => {
153 153
       console.log("onUpdateComment", type);