import apiClient from '@api/api-client'; import { API_BASE_URL } from '@/shared/constants'; import { IServerResponse } from '@/types/common.types'; import { toQueryString } from '@/utils/toQueryString'; import { IMyTask } from '@/types/home/my-tasks.types'; import { IWorklenzNotification } from '@/types/notifications/notifications.types'; const rootUrl = `${API_BASE_URL}/notifications`; export const notificationsApiService = { getNotifications: async (filter: string): Promise> => { const q = toQueryString({ filter }); const response = await apiClient.get>( `${rootUrl}${q}` ); return response.data; }, updateNotification: async (id: string): Promise> => { const response = await apiClient.put>(`${rootUrl}/${id}`); return response.data; }, readAllNotifications: async (): Promise> => { const response = await apiClient.put>(`${rootUrl}/read-all`); return response.data; }, getUnreadCount: async (): Promise> => { const response = await apiClient.get>(`${rootUrl}/unread-count`); return response.data; }, };