only clear comment text if confirmed
This commit is contained in:
parent
108a898ebf
commit
57a09cd3c6
2 changed files with 10 additions and 8 deletions
|
@ -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);
|
||||
|
|
|
@ -209,6 +209,7 @@ export function doCommentCreate(
|
|||
claimId: claim_id,
|
||||
},
|
||||
});
|
||||
return result;
|
||||
})
|
||||
.catch(error => {
|
||||
dispatch({
|
||||
|
|
Loading…
Reference in a new issue