only clear comment text if confirmed

This commit is contained in:
jessop 2020-09-29 20:11:48 -04:00 committed by Sean Yesmunt
parent 108a898ebf
commit 57a09cd3c6
2 changed files with 10 additions and 8 deletions

View file

@ -14,7 +14,7 @@ import { useHistory } from 'react-router';
type Props = {
uri: string,
claim: StreamClaim,
createComment: (string, string, string, ?string) => void,
createComment: (string, string, string, ?string) => Promise<any>,
channels: ?Array<ChannelClaim>,
topLevelId?: string,
onDoneReplying?: () => void,
@ -61,15 +61,16 @@ export function CommentCreate(props: Props) {
function handleSubmit() {
if (channel !== CHANNEL_NEW && commentValue.length) {
createComment(commentValue, claimId, channel, topLevelId);
}
createComment(commentValue, claimId, channel, topLevelId).then(res => {
if (res && res.signature) {
setCommentValue('');
if (onDoneReplying) {
onDoneReplying();
}
}
});
}
}
function toggleEditorMode() {
setAdvancedEditor(!advancedEditor);

View file

@ -209,6 +209,7 @@ export function doCommentCreate(
claimId: claim_id,
},
});
return result;
})
.catch(error => {
dispatch({