import type { Notification } from './dto/notification' import type { HydraCollection } from '~/utils/api' import { extractHydraMembers } from '~/utils/api' export function useNotificationService() { const api = useApi() async function getAll(): Promise { const data = await api.get>('/notifications') return extractHydraMembers(data) } async function markAsRead(id: number): Promise { await api.patch(`/notifications/${id}`, { isRead: true }, { toast: false, }) } async function markAllAsRead(): Promise { await api.post('/notifications/mark-all-read', {}, { toast: false, }) } async function getUnreadCount(): Promise { const data = await api.get<{ count: number }>('/notifications/unread-count', {}, { toast: false, }) return data.count } return { getAll, markAsRead, markAllAsRead, getUnreadCount } }