feat: implement user reporting functionality with a dedicated modal and service, integrated into the chat header.
This commit is contained in:
29
src/services/user-reports.service.ts
Normal file
29
src/services/user-reports.service.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import api, { ApiResponse } from './api';
|
||||
|
||||
interface CreateReportDto {
|
||||
reportedUserId: string;
|
||||
conversationId?: string;
|
||||
reason: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
interface UserReport {
|
||||
id: string;
|
||||
reporterId: string;
|
||||
reportedUserId: string;
|
||||
conversationId: string | null;
|
||||
reason: string;
|
||||
description: string | null;
|
||||
status: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
class UserReportsService {
|
||||
async createReport(dto: CreateReportDto): Promise<UserReport> {
|
||||
const response = await api.post<ApiResponse<UserReport>>('/user-reports', dto);
|
||||
return response.data.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const userReportsService = new UserReportsService();
|
||||
export type { CreateReportDto, UserReport };
|
||||
Reference in New Issue
Block a user