diff --git a/src/store/index.ts b/src/store/index.ts index ed26a54..eca10eb 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,6 +1,7 @@ import { api, isAxiosError } from '@flaschengeist/api'; import { defineStore } from 'pinia'; import { EditableEvent } from './models'; +import { Notify } from 'quasar'; /** * Convert JSON decoded Job to real job (fix Date object) @@ -208,7 +209,10 @@ export const useEventStore = defineStore({ await api.delete(`/events/invitations/${typeof invite === 'number' ? invite : invite.id}`); const idx = this.invitations.findIndex((v) => v.id === (invite.id || invite)); if (idx >= 0) this.invitations.splice(idx, 1); - } catch (e) {} + notify_success('Einladung für erfolgreich abgelehnt'); + } catch (e) { + notify_failure(); + } }, async acceptInvitation(invite: FG.Invitation | number) { @@ -218,7 +222,30 @@ export const useEventStore = defineStore({ }); const idx = this.invitations.findIndex((v) => v.id === (invite.id || invite)); if (idx >= 0) this.invitations.splice(idx, 1); - } catch (e) {} + notify_success('Einladung für erfolgreich angenommen'); + } catch (e) { + notify_failure(); + } }, }, }); + +function notify_failure() { + Notify.create({ + message: 'Es ist ein Fehler aufgetreten.', + color: 'negative', + group: false, + timeout: 10000, + actions: [{ icon: 'mdi-close', color: 'white' }], + }); +} + +function notify_success(msg: string) { + Notify.create({ + message: msg, + color: 'positive', + group: false, + timeout: 5000, + actions: [{ icon: 'mdi-close', color: 'white' }], + }); +}