mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-19 19:21:12 +10:00
update to nuxt 4
This commit is contained in:
12
app/composables/notifications.ts
Normal file
12
app/composables/notifications.ts
Normal file
@ -0,0 +1,12 @@
|
||||
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);
|
||||
});
|
||||
Reference in New Issue
Block a user