implemented notification component and logic
This commit is contained in:
20
src/stores/notifications.ts
Normal file
20
src/stores/notifications.ts
Normal 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))
|
||||
}
|
||||
Reference in New Issue
Block a user