Files
lcbp3/frontend/lib/services/notification.service.ts
admin dcd126d704
Some checks failed
Spec Validation / validate-markdown (push) Has been cancelled
Spec Validation / validate-diagrams (push) Has been cancelled
Spec Validation / check-todos (push) Has been cancelled
251208:0010 Backend & Frontend Debug
2025-12-08 00:10:37 +07:00

22 lines
722 B
TypeScript

import apiClient from "@/lib/api/client";
import { NotificationResponse } from "@/types/notification";
export const notificationService = {
getUnread: async (): Promise<NotificationResponse> => {
const response = await apiClient.get("/notifications/unread");
// Backend should return { items: [], unreadCount: number }
// Or just items and we count on frontend, but typically backend gives count.
return response.data;
},
markAsRead: async (id: number) => {
const response = await apiClient.patch(`/notifications/${id}/read`);
return response.data;
},
markAllAsRead: async () => {
const response = await apiClient.patch(`/notifications/read-all`);
return response.data;
}
};