From c58ebd1751eff8585ccdfbcf72cddd23a240d263 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 4 Jun 2019 22:39:55 +0100 Subject: [PATCH] Display new session in the sessions list straight away --- src/App.vue | 8 +++++++- src/components/SessionForm.vue | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/App.vue b/src/App.vue index 386ad8d..60e6855 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,7 +2,7 @@
- +
@@ -39,6 +39,12 @@ export default { }) }, + methods: { + addSession: function (session) { + this.sessions.push(session) + } + }, + computed: { sortedSessions: function () { return _(this.sessions).sortBy(session => session.attributes.title) diff --git a/src/components/SessionForm.vue b/src/components/SessionForm.vue index e19069b..d0b1c45 100644 --- a/src/components/SessionForm.vue +++ b/src/components/SessionForm.vue @@ -86,6 +86,8 @@ export default { this.messages.push(`Session ${title} has been created.`) this.errors = [] + this.$emit('submitted', data.data) + this.form.body = '' this.form.title = '' })