// https://dev.to/stephannv/how-to-create-a-global-snackbar-using-nuxt-vuetify-and-vuex-1bda // https://dev.to/dzvid/comment/17nip const snackbarPlugin = { install: (Vue, {store}) => { if (!store) { throw new Error('Please provide vuex store.'); } Vue.prototype.$snackbar = { showMessage: function ({content = '', color = ''}) { store.commit( 'snackbar/showMessage', {content, color}, {root: true} ); } }; }, }; export default snackbarPlugin;