introduced the notification-store, which allows to notify the user about new messages

This commit is contained in:
joschuatonn
2024-06-16 18:04:52 +02:00
parent a5c4aea738
commit a57f0c11e8

View File

@@ -0,0 +1,19 @@
import { defineStore } from 'pinia';
export const useNotificationStore = defineStore('notificationStore',{
state:() => ({
decision: false,
isTabActive: true,
}),
actions: {
saveDecision(decision : boolean) {
this.decision = decision;
},
sendNotificationIfAllowed(image : string, headline : string, message : string) {
if(this.decision && !this.isTabActive){
new Notification(headline, { body: message, icon: image });
}
}
}
});