diff --git a/webapp/locales/en.json b/webapp/locales/en.json index af4e50c11..c74cbed52 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -112,7 +112,8 @@ "takeAction": { "name": "Take action" }, - "submitComment": "Submit Comment" + "submitComment": "Submit Comment", + "commentSubmitted": "Comment Submitted" }, "quotes": { "african": { diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 1803541d4..60ed15c20 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -112,33 +112,46 @@ - - - - - - - - {{ $t('actions.cancel') }} - - - - - {{ $t('post.submitComment') }} - - - + + + @@ -201,7 +214,13 @@ export default { ready: false, title: 'loading', loading: false, - disabled: false + disabled: false, + form: { + content: '' + }, + formSchema: { + content: { required: true, min: 3 } + } } }, watch: { @@ -317,14 +336,17 @@ export default { isAuthor(id) { return this.$store.getters['auth/user'].id === id }, + updateEditorContent(value) { + // this.form.content = value + this.$refs.contributionForm.update('content', value) + }, addComment(comment) { this.$apollo.queries.Post.refetch() // this.post = { ...this.post, comments: [...this.post.comments, comment] } }, handleSubmit() { - const value = this.value - this.value = '' - this.loading = true + const content = this.form.content + this.form.content = '' this.$apollo .mutate({ mutation: gql` @@ -337,14 +359,14 @@ export default { `, variables: { postId: this.post.id, - content: value + content: content } }) .then(res => { this.addComment(res.data.CreateComment) - this.disabled = true this.loading = false - this.$toast.success('Saved!') + this.disabled = false + this.$toast.success(this.$t('post.commentSubmitted')) }) .catch(err => { this.$toast.error(err.message)