mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-01-31 15:37:09 +01:00
* fix: add no-prisma-delete lint * fix: typescript for lint * fix: bump droplet * fix: oidc scopes override * fix: type errors * feat: delete all notifications * fix: lint * fix: light mode style fixes
17 lines
497 B
TypeScript
17 lines
497 B
TypeScript
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<SerializeObject<NotificationModel>>>(
|
|
"notifications",
|
|
() => [],
|
|
);
|
|
|
|
ws.listen((e) => {
|
|
const notification = JSON.parse(e) as SerializeObject<NotificationModel>;
|
|
const notifications = useNotifications();
|
|
notifications.value.push(notification);
|
|
});
|