feat: add reviews, notifications, notes and account hardening
This commit is contained in:
29
services/notifications.ts
Normal file
29
services/notifications.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { apiRequest } from './api';
|
||||
|
||||
export type NotificationItem = {
|
||||
id: string;
|
||||
kind: string;
|
||||
title: string;
|
||||
body: string;
|
||||
href: string;
|
||||
readAt: string | null;
|
||||
createdAt: string;
|
||||
};
|
||||
|
||||
export type NotificationFeed = {
|
||||
items: NotificationItem[];
|
||||
unread: number;
|
||||
};
|
||||
|
||||
export const getNotifications = async (): Promise<NotificationFeed> => {
|
||||
const response = await apiRequest<{ data: NotificationFeed }>('/notifications');
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const markNotificationRead = async (notificationId: string): Promise<void> => {
|
||||
await apiRequest<void>(`/notifications/${notificationId}/read`, { method: 'POST' });
|
||||
};
|
||||
|
||||
export const markAllNotificationsRead = async (): Promise<void> => {
|
||||
await apiRequest<void>('/notifications/read-all', { method: 'POST' });
|
||||
};
|
||||
Reference in New Issue
Block a user