finished login form validation and self-destroying notifications

This commit is contained in:
Sockenklaus
2021-10-25 15:58:30 +02:00
parent bc56f65abd
commit a65d01c36d
3 changed files with 96 additions and 37 deletions

View File

@@ -14,7 +14,7 @@ export const useNotifications = defineStore('notifications', {
this.notifications.delete(id)
},
add(type : string, text: string) : void {
add(type : string, text: string, timeout: number = 1000) : void {
const id = uuidv4()
this.notifications.set(
id,
@@ -23,7 +23,7 @@ export const useNotifications = defineStore('notifications', {
text:text,
}
)
setTimeout(() => this.remove(id), 1500)
if (timeout !== -1) setTimeout(() => this.remove(id), timeout)
}
}
})