From 0c0b8a79af71b5de09edcd67499db3cd0aae20eb Mon Sep 17 00:00:00 2001 From: busti Date: Sun, 29 Dec 2019 22:27:30 +0100 Subject: [PATCH] only close the post modal when the request succeeds --- src/components/AddItemModal.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/AddItemModal.vue b/src/components/AddItemModal.vue index ff65ddb..a415bad 100644 --- a/src/components/AddItemModal.vue +++ b/src/components/AddItemModal.vue @@ -28,8 +28,9 @@ export default { }, methods: { saveNewItem() { - this.$store.dispatch('postItem', this.item); - this.$emit('close'); + this.$store.dispatch('postItem', this.item).then(() => { + this.$emit('close'); + }); } } };