feat(notifications): added notification system w/ interwoven refactoring

This commit is contained in:
DecDuck
2024-11-16 19:41:19 +11:00
parent 4db9ebe66a
commit 3652d6123c
22 changed files with 498 additions and 56 deletions
+12
View File
@@ -0,0 +1,12 @@
import type { Notification } from "@prisma/client";
const ws = new WebSocketHandler("/api/v1/notifications/ws");
export const useNotifications = () =>
useState<Array<Notification>>("notifications", () => []);
ws.listen((e) => {
const notification = JSON.parse(e) as Notification;
const notifications = useNotifications();
notifications.value.push(notification);
});