Moved snackbars to their own store and component

This commit is contained in:
Stefan Zermatten
2020-10-17 16:06:27 +02:00
parent 46189c68df
commit e8da7a6c17
5 changed files with 97 additions and 70 deletions

View File

@@ -93,9 +93,6 @@
required: true,
},
},
data(){return {
snackbars: [],
}},
reactiveProvide: {
name: 'context',
include: ['creature', 'editPermission'],
@@ -124,10 +121,10 @@
added(doc){
if (!that.$subReady.singleCharacter) return;
if (that.$store.state.rightDrawer) return;
if (that.snackbars.some(o => o._id === doc._id)) return;
doc.open = true;
that.$store.commit('snackbar', {
doc
if (that.$store.state.snackbars.snackbars.some(o => o._id === doc._id)) return;
that.$store.dispatch('snackbar', {
text: doc.text,
showCloseButton: true,
});
},
});