22 lines
725 B
TypeScript
22 lines
725 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 (uuid: string) => {
|
|
const response = await apiClient.put(`/notifications/${uuid}/read`);
|
|
return response.data;
|
|
},
|
|
|
|
markAllAsRead: async () => {
|
|
const response = await apiClient.patch(`/notifications/read-all`);
|
|
return response.data;
|
|
},
|
|
};
|