mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
13 lines
401 B
TypeScript
13 lines
401 B
TypeScript
import type { NotificationModel } from "~~/prisma/client/models";
|
|
|
|
const ws = new WebSocketHandler("/api/v1/notifications/ws");
|
|
|
|
export const useNotifications = () =>
|
|
useState<Array<NotificationModel>>("notifications", () => []);
|
|
|
|
ws.listen((e) => {
|
|
const notification = JSON.parse(e) as NotificationModel;
|
|
const notifications = useNotifications();
|
|
notifications.value.push(notification);
|
|
});
|