feat: 新增通知服务,包含获取通知列表、未读计数以及标记通知为已读的功能。
This commit is contained in:
@@ -31,7 +31,8 @@ export interface UnreadCountResponse {
|
||||
|
||||
export const notificationService = {
|
||||
getNotifications: (page: number = 1, limit: number = 10, isRead?: boolean) => {
|
||||
const params: Record<string, string | number | boolean> = { page, limit };
|
||||
const offset = (page - 1) * limit;
|
||||
const params: Record<string, string | number | boolean> = { offset, limit };
|
||||
if (isRead !== undefined) {
|
||||
params.is_read = isRead;
|
||||
}
|
||||
@@ -47,6 +48,6 @@ export const notificationService = {
|
||||
},
|
||||
|
||||
markAllAsRead: () => {
|
||||
return api.put<{ success: boolean }>('/notifications/read-all');
|
||||
return api.post<{ success: boolean }>('/notifications/read-all');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user