mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-26 09:50:33 +01:00
remove old files
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
import type { Notification } from '../types/notification'
|
||||
import { useState } from '#imports'
|
||||
|
||||
export function useToast () {
|
||||
const notifications = useState<Notification[]>('notifications', () => [])
|
||||
|
||||
function add (notification: Partial<Notification>) {
|
||||
const body = {
|
||||
id: new Date().getTime().toString(),
|
||||
...notification
|
||||
}
|
||||
|
||||
const index = notifications.value.findIndex((n: Notification) => n.id === body.id)
|
||||
if (index === -1) {
|
||||
notifications.value.push(body as Notification)
|
||||
}
|
||||
|
||||
return body
|
||||
}
|
||||
|
||||
function remove (id: string) {
|
||||
notifications.value = notifications.value.filter((n: Notification) => n.id !== id)
|
||||
}
|
||||
|
||||
return {
|
||||
add,
|
||||
remove
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user