25 lines
857 B
TypeScript
25 lines
857 B
TypeScript
import { NotificationItem, MarkNotificationReadResponse, ClearNotificationsResponse } from '@interfaces';
|
|
import { api } from '@utils';
|
|
|
|
export const getStaffNotificationsApi = async (
|
|
staffId: string,
|
|
): Promise<NotificationItem[]> => {
|
|
const url = `/api/staff_notification/${staffId}`;
|
|
return await api.get<NotificationItem[]>(url);
|
|
};
|
|
|
|
export const markNotificationReadApi = async (
|
|
staffId: string,
|
|
notificationId: string,
|
|
): Promise<MarkNotificationReadResponse> => {
|
|
const url = `/api/staff_notification_read/${staffId}/${notificationId}`;
|
|
return await api.post<MarkNotificationReadResponse>(url, {});
|
|
};
|
|
|
|
export const clearNotificationsApi = async (
|
|
staffId: string,
|
|
): Promise<ClearNotificationsResponse> => {
|
|
const url = `/api/staff_notification_clear/${staffId}`;
|
|
return await api.post<ClearNotificationsResponse>(url, {});
|
|
};
|