879aa2c3d8
* feat: watchers notification and email preferences * fix: email copy * digests * clean up * fix * clean up * move backlinks queue-up to history processor * fix * fix keys * feat: group notifications * filter * adjust email digest window
33 lines
866 B
TypeScript
33 lines
866 B
TypeScript
import api from "@/lib/api-client";
|
|
import { INotification } from "../types/notification.types";
|
|
import { IPagination } from "@/lib/types";
|
|
|
|
export async function getNotifications(params: {
|
|
limit?: number;
|
|
cursor?: string;
|
|
type?: string;
|
|
}): Promise<IPagination<INotification>> {
|
|
const req = await api.post<IPagination<INotification>>(
|
|
"/notifications",
|
|
params,
|
|
);
|
|
return req.data;
|
|
}
|
|
|
|
export async function getUnreadCount(): Promise<{ count: number }> {
|
|
const req = await api.post<{ count: number }>(
|
|
"/notifications/unread-count",
|
|
);
|
|
return req.data;
|
|
}
|
|
|
|
export async function markNotificationsRead(
|
|
notificationIds: string[],
|
|
): Promise<void> {
|
|
await api.post("/notifications/mark-read", { notificationIds });
|
|
}
|
|
|
|
export async function markAllNotificationsRead(): Promise<void> {
|
|
await api.post("/notifications/mark-all-read");
|
|
}
|