feat: delete all notifications

This commit is contained in:
DecDuck
2025-11-22 10:28:21 +11:00
parent 973c3efa18
commit e230f79b54
6 changed files with 76 additions and 33 deletions

View File

@ -1,12 +1,13 @@
import type { SerializeObject } from "nitropack";
import type { NotificationModel } from "~/prisma/client/models";
const ws = new WebSocketHandler("/api/v1/notifications/ws");
export const useNotifications = () =>
useState<Array<NotificationModel>>("notifications", () => []);
useState<Array<SerializeObject<NotificationModel>>>("notifications", () => []);
ws.listen((e) => {
const notification = JSON.parse(e) as NotificationModel;
const notification = JSON.parse(e) as SerializeObject<NotificationModel>;
const notifications = useNotifications();
notifications.value.push(notification);
});