From 9cdc041b13d5451f1ac409fa6eda3541d79f281d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sat, 14 Nov 2020 15:04:42 +0100 Subject: [PATCH] =?UTF-8?q?[Notify]=20Fehlermeldung=20wenn=20etwas=20nicht?= =?UTF-8?q?=20ausgef=C3=BChrt=20werden=20konnte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/boot/axios.ts | 7 +++++++ src/boot/notify.ts | 14 ++++++++++++++ src/plugins/user/store/session.ts | 1 + 3 files changed, 22 insertions(+) create mode 100644 src/boot/notify.ts diff --git a/src/boot/axios.ts b/src/boot/axios.ts index da8b148..99b80ee 100644 --- a/src/boot/axios.ts +++ b/src/boot/axios.ts @@ -3,6 +3,7 @@ import { boot } from 'quasar/wrappers'; import config from '../config'; import { Store } from 'vuex'; import { StateInterface } from 'src/store'; +import { Notify } from 'quasar'; declare module 'vue/types/vue' { interface Vue { @@ -43,6 +44,12 @@ export default boot>(({ Vue, store }) => { store.commit('session/setOffline', true); } else if (e.response && e.response.status == 401) { return store.dispatch('session/clearCurrent'); + } else { + Notify.create({ + type: 'error', + message: 'Eine Aktion konnte nicht durchgeführt werden.', + group: false + }); } } return Promise.reject(error); diff --git a/src/boot/notify.ts b/src/boot/notify.ts new file mode 100644 index 0000000..513290d --- /dev/null +++ b/src/boot/notify.ts @@ -0,0 +1,14 @@ +import { boot } from 'quasar/wrappers'; +import { Notify } from 'quasar'; + +// "async" is optional; +// more info on params: https://quasar.dev/quasar-cli/boot-files +export default boot((/* { app, router, Vue ... } */) => { + Notify.registerType('error', { + color: 'negative', + icon: 'mdi-alert-circle', + progress: true, + position: 'bottom', + actions: [{ icon: 'mdi-close', color: 'white' }] + }); +}); diff --git a/src/plugins/user/store/session.ts b/src/plugins/user/store/session.ts index d605f65..e946614 100644 --- a/src/plugins/user/store/session.ts +++ b/src/plugins/user/store/session.ts @@ -70,6 +70,7 @@ const actions: ActionTree = { }) .catch(() => { Notify.create({ + group: false, type: 'negative', message: 'Benutzername oder Passwort sind falsch.', timeout: 10000,