implemented notification component and logic

This commit is contained in:
Sockenklaus
2021-10-21 01:24:46 +02:00
parent 5017be6d42
commit 7e5ab9b445
6 changed files with 129 additions and 26 deletions

View File

@@ -0,0 +1,20 @@
import { defineStore, acceptHMRUpdate } from 'pinia'
export const useNotifications = defineStore('notifications', {
state: () => {
return {
/**@type {{type: string, text: string}[]} */
notifications: new Array<{type: string, text: string}>()
}
},
actions: {
removeAlert(index : number) : void {
this.notifications.splice(index, 1)
}
}
})
if(import.meta.hot) {
import.meta.hot.accept(acceptHMRUpdate(useNotifications, import.meta.hot))
}