From d23abecff9274230791b3a012bbc92e642de5308 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Thu, 4 Apr 2019 00:45:51 +0300 Subject: [PATCH] Add alert message when note is empty --- src/views/reports/components/TimelineItem.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/views/reports/components/TimelineItem.vue b/src/views/reports/components/TimelineItem.vue index 313ee577..2bc137aa 100644 --- a/src/views/reports/components/TimelineItem.vue +++ b/src/views/reports/components/TimelineItem.vue @@ -55,10 +55,14 @@ export default { this.$data.showNewNoteInput = !this.$data.showNewNoteInput }, addNewNote(reportId) { - const currentUserNickname = this.$store.state.user.name - const note = { author: currentUserNickname, text: this.$data.note, timestamp: '2019/04/01' } - this.$store.dispatch('AddNote', { reportId, note }) - this.$data.note = '' + if (this.$data.note.length < 2) { + this.$message('Note must contain at least 2 characters') + } else { + const currentUserNickname = this.$store.state.user.name + const note = { author: currentUserNickname, text: this.$data.note, timestamp: '2019/04/01' } + this.$store.dispatch('AddNote', { reportId, note }) + this.$data.note = '' + } }, deleteNote(reportId, noteId) { this.$confirm(i18n.t('reports.confirmMsg'), {