29 lines
769 B
TypeScript
29 lines
769 B
TypeScript
|
|
import { apiClient } from './apiClient';
|
||
|
|
|
||
|
|
export interface Report {
|
||
|
|
id: string;
|
||
|
|
user_id?: string;
|
||
|
|
user_name?: string;
|
||
|
|
message: string;
|
||
|
|
status: 'pending' | 'resolved' | 'archived';
|
||
|
|
created_at: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const reportsService = {
|
||
|
|
async sendReport(message: string) {
|
||
|
|
const response = await apiClient.post('/api/reports', { message });
|
||
|
|
return response.data;
|
||
|
|
},
|
||
|
|
|
||
|
|
async getReports() {
|
||
|
|
// This would be for the admin
|
||
|
|
const response = await apiClient.get('/api/reports');
|
||
|
|
return response.data;
|
||
|
|
},
|
||
|
|
|
||
|
|
async updateReportStatus(reportId: string, status: string) {
|
||
|
|
const response = await apiClient.patch(`/api/reports/${reportId}`, { status });
|
||
|
|
return response.data;
|
||
|
|
}
|
||
|
|
};
|