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>
<div id="app">
<AddItem v-if="addModalOpen" @close="closeAddModal()" isModal="true"/>
<AddItemModal v-if="addModalOpen" @close="closeAddModal()" isModal="true"/>
<Navbar @addClicked="openAddModal()"/>
<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">
@ -11,13 +11,13 @@
<script>
import Navbar from '@/components/Navbar';
import AddItem from '@/components/AddItem';
import AddItemModal from '@/components/AddItem';
import Toast from './components/Toast';
import { mapState, mapMutations } from 'vuex';
export default {
name: 'app',
components: { Toast, Navbar, AddItem },
components: { Toast, Navbar, AddItemModal },
computed: mapState(['loadedItems', 'layout', 'toasts']),
data: () => ({
addModalOpen: false

View file

@ -17,7 +17,7 @@ import Modal from '@/components/Modal';
import EditItem from '@/components/EditItem';
export default {
name: 'AddItem',
name: 'AddItemModal',
components: { Modal, EditItem },
props: ['isModal'],
data: () => ({
@ -26,6 +26,7 @@ export default {
methods: {
saveNewItem() {
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.
this.$store.dispatch('updateItem', this.editingItem);
this.closeLightboxModal();
this.closeEditingModal();
}
}
};