Extract error msg from API response for preview.

This commit is contained in:
sharief007
2023-10-08 12:53:04 -05:00
committed by Umputun
parent 40a0d7ca62
commit eba447319d
@@ -180,8 +180,8 @@ export class CommentForm extends Component<Props, State> {
this.props
.getPreview(text)
.then((preview) => this.setState({ preview }))
.catch(() => {
this.setState({ isErrorShown: true, errorMessage: null });
.catch((e) => {
this.setState({ isErrorShown: true, errorMessage: extractErrorMessageFromResponse(e, this.props.intl) });
});
};