[Notify] Fehlermeldung wenn etwas nicht ausgeführt werden konnte

This commit is contained in:
Tim Gröger 2020-11-14 15:04:42 +01:00
parent 306ae7648d
commit 9cdc041b13
3 changed files with 22 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import { boot } from 'quasar/wrappers';
import config from '../config'; import config from '../config';
import { Store } from 'vuex'; import { Store } from 'vuex';
import { StateInterface } from 'src/store'; import { StateInterface } from 'src/store';
import { Notify } from 'quasar';
declare module 'vue/types/vue' { declare module 'vue/types/vue' {
interface Vue { interface Vue {
@ -43,6 +44,12 @@ export default boot<Store<StateInterface>>(({ Vue, store }) => {
store.commit('session/setOffline', true); store.commit('session/setOffline', true);
} else if (e.response && e.response.status == 401) { } else if (e.response && e.response.status == 401) {
return store.dispatch('session/clearCurrent'); return store.dispatch('session/clearCurrent');
} else {
Notify.create({
type: 'error',
message: 'Eine Aktion konnte nicht durchgeführt werden.',
group: false
});
} }
} }
return Promise.reject(error); return Promise.reject(error);

14
src/boot/notify.ts Normal file
View File

@ -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' }]
});
});

View File

@ -70,6 +70,7 @@ const actions: ActionTree<SessionInterface, StateInterface> = {
}) })
.catch(() => { .catch(() => {
Notify.create({ Notify.create({
group: false,
type: 'negative', type: 'negative',
message: 'Benutzername oder Passwort sind falsch.', message: 'Benutzername oder Passwort sind falsch.',
timeout: 10000, timeout: 10000,