mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
feat(notifications): added notification system w/ interwoven refactoring
This commit is contained in:
12
composables/notifications.ts
Normal file
12
composables/notifications.ts
Normal 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);
|
||||
});
|
||||
2
composables/types.d.ts
vendored
2
composables/types.d.ts
vendored
@ -8,6 +8,6 @@ export type NavigationItem = {
|
||||
|
||||
export type QuickActionNav = {
|
||||
icon: Component,
|
||||
notifications?: number,
|
||||
notifications?: Ref<number>,
|
||||
action: () => Promise<void>,
|
||||
}
|
||||
Reference in New Issue
Block a user