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

View file

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