close modals when saving

This commit is contained in:
busti 2019-12-27 02:38:58 +01:00
parent d3a52aae06
commit 7131a54455
3 changed files with 6 additions and 5 deletions

View file

@ -1,6 +1,6 @@
<template> <template>
<div id="app"> <div id="app">
<AddItem v-if="addModalOpen" @close="closeAddModal()" isModal="true"/> <AddItemModal v-if="addModalOpen" @close="closeAddModal()" isModal="true"/>
<Navbar @addClicked="openAddModal()"/> <Navbar @addClicked="openAddModal()"/>
<router-view/> <router-view/>
<div aria-live="polite" aria-atomic="true" class="d-flex justify-content-end align-items-start fixed-top mx-1 my-5 py-3" style="min-height: 200px; z-index: 100000"> <div aria-live="polite" aria-atomic="true" class="d-flex justify-content-end align-items-start fixed-top mx-1 my-5 py-3" style="min-height: 200px; z-index: 100000">
@ -11,13 +11,13 @@
<script> <script>
import Navbar from '@/components/Navbar'; import Navbar from '@/components/Navbar';
import AddItem from '@/components/AddItem'; import AddItemModal from '@/components/AddItem';
import Toast from './components/Toast'; import Toast from './components/Toast';
import { mapState, mapMutations } from 'vuex'; import { mapState, mapMutations } from 'vuex';
export default { export default {
name: 'app', name: 'app',
components: { Toast, Navbar, AddItem }, components: { Toast, Navbar, AddItemModal },
computed: mapState(['loadedItems', 'layout', 'toasts']), computed: mapState(['loadedItems', 'layout', 'toasts']),
data: () => ({ data: () => ({
addModalOpen: false addModalOpen: false

View file

@ -17,7 +17,7 @@ import Modal from '@/components/Modal';
import EditItem from '@/components/EditItem'; import EditItem from '@/components/EditItem';
export default { export default {
name: 'AddItem', name: 'AddItemModal',
components: { Modal, EditItem }, components: { Modal, EditItem },
props: ['isModal'], props: ['isModal'],
data: () => ({ data: () => ({
@ -26,6 +26,7 @@ export default {
methods: { methods: {
saveNewItem() { saveNewItem() {
this.$store.dispatch('postItem', this.item); this.$store.dispatch('postItem', this.item);
this.$emit('close');
} }
} }
}; };

View file

@ -97,7 +97,7 @@ export default {
}, },
saveEditingItem() { // Saves the edited copy of the item. saveEditingItem() { // Saves the edited copy of the item.
this.$store.dispatch('updateItem', this.editingItem); this.$store.dispatch('updateItem', this.editingItem);
this.closeLightboxModal(); this.closeEditingModal();
} }
} }
}; };