|
@@ -310,7 +310,10 @@ class App extends Component {
|
310
|
310
|
this.setState({ list, total: total + 1 });
|
311
|
311
|
this.props.onCountChange(total + 1);
|
312
|
312
|
})
|
313
|
|
- .catch(this.errorHandler)
|
|
313
|
+ .catch(error => {
|
|
314
|
+ this.props.onCommentFail(error.response.status);
|
|
315
|
+ this.errorHandler(error);
|
|
316
|
+ })
|
314
|
317
|
.finally(() => {
|
315
|
318
|
this.handleChangeLoading("sCreateComment", false);
|
316
|
319
|
});
|
|
@@ -407,7 +410,10 @@ class App extends Component {
|
407
|
410
|
});
|
408
|
411
|
this.setState({ list });
|
409
|
412
|
})
|
410
|
|
- .catch(this.errorHandler)
|
|
413
|
+ .catch(error => {
|
|
414
|
+ this.props.onCommentFail(error.response.status);
|
|
415
|
+ this.errorHandler(error);
|
|
416
|
+ })
|
411
|
417
|
.finally(() => {
|
412
|
418
|
this.handleChangeLoading("sCreateReply", false);
|
413
|
419
|
});
|
|
@@ -640,7 +646,8 @@ App.propTypes = {
|
640
|
646
|
onDelete: PropTypes.func,
|
641
|
647
|
onUpdateComment: PropTypes.func,
|
642
|
648
|
locales: PropTypes.string, // 传入的语言环境, en-US/zh-CN
|
643
|
|
- onCountChange: PropTypes.func // 评论数量变更时的回调
|
|
649
|
+ onCountChange: PropTypes.func, // 评论数量变更时的回调
|
|
650
|
+ onCommentFail: PropTypes.func // 评论失败时的回调
|
644
|
651
|
};
|
645
|
652
|
|
646
|
653
|
App.defaultProps = {
|
|
@@ -665,7 +672,8 @@ App.defaultProps = {
|
665
|
672
|
onDelete: () => {},
|
666
|
673
|
onUpdateComment: () => {},
|
667
|
674
|
onBeforeUpdateComment: () => {},
|
668
|
|
- onCountChange: () => {}
|
|
675
|
+ onCountChange: () => {},
|
|
676
|
+ onCommentFail: () => {}
|
669
|
677
|
};
|
670
|
678
|
|
671
|
679
|
export { Editor, RenderText };
|