From 0a706d1b45710b5e9ec6f040335020680dd3c6a6 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 26 May 2018 14:50:38 -0700 Subject: [PATCH] Add custom flash library that works as expected --- package.json | 1 - resources/assets/scripts/app.js | 6 +- resources/assets/scripts/components/Flash.vue | 92 +++++++++++++++++++ .../components/auth/ForgotPassword.vue | 14 +-- .../assets/scripts/components/auth/Login.vue | 5 +- .../scripts/components/auth/LoginForm.vue | 14 +-- .../scripts/components/auth/ResetPassword.vue | 12 +-- .../scripts/components/auth/TwoFactorForm.vue | 5 +- resources/assets/scripts/mixins/flash.js | 62 +++++++++++++ .../assets/styles/components/animations.css | 8 ++ .../styles/components/notifications.css | 46 ++++++++++ resources/assets/styles/main.css | 1 + yarn.lock | 4 - 13 files changed, 233 insertions(+), 37 deletions(-) create mode 100644 resources/assets/scripts/components/Flash.vue create mode 100644 resources/assets/scripts/mixins/flash.js create mode 100644 resources/assets/styles/components/notifications.css diff --git a/package.json b/package.json index 45825c2ab..a790e437f 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,6 @@ "vue-template-compiler": "^2.5.16", "vueify-insert-css": "^1.0.0", "vuex": "^3.0.1", - "vuex-flash": "^1.0.0", "vuex-i18n": "^1.10.5", "webpack": "^4.4.1", "webpack-stream": "^4.0.3", diff --git a/resources/assets/scripts/app.js b/resources/assets/scripts/app.js index 0c5dd17e1..f53781c09 100644 --- a/resources/assets/scripts/app.js +++ b/resources/assets/scripts/app.js @@ -1,19 +1,19 @@ import Vue from 'vue'; import Vuex from 'vuex'; import vuexI18n from 'vuex-i18n'; -import VuexFlash from 'vuex-flash'; import { createFlashStore } from 'vuex-flash'; import VueRouter from 'vue-router'; // Helpers import { Ziggy } from './helpers/ziggy'; import Locales from './../../../resources/lang/locales'; +import { flash } from './mixins/flash'; // Base Vuejs Templates import Login from './components/auth/Login'; import ResetPassword from './components/auth/ResetPassword'; -// Used for the route() helper. +window.events = new Vue; window.Ziggy = Ziggy; Vue.use(Vuex); @@ -23,10 +23,10 @@ const route = require('./../../../vendor/tightenco/ziggy/src/js/route').default; Vue.config.productionTip = false; Vue.mixin({ methods: { route } }); +Vue.mixin(flash); Vue.use(VueRouter); Vue.use(vuexI18n.plugin, store); -Vue.use(VuexFlash, { mixin: true, template: require('./components/errors/Flash.template') }); Vue.i18n.add('en', Locales.en); Vue.i18n.set('en'); diff --git a/resources/assets/scripts/components/Flash.vue b/resources/assets/scripts/components/Flash.vue new file mode 100644 index 000000000..ac41e4dd9 --- /dev/null +++ b/resources/assets/scripts/components/Flash.vue @@ -0,0 +1,92 @@ + + + diff --git a/resources/assets/scripts/components/auth/ForgotPassword.vue b/resources/assets/scripts/components/auth/ForgotPassword.vue index 97029e1ce..e06fa40b4 100644 --- a/resources/assets/scripts/components/auth/ForgotPassword.vue +++ b/resources/assets/scripts/components/auth/ForgotPassword.vue @@ -1,12 +1,5 @@