Files
road-monitoring-ui/src/services/api/detection.service.ts

37 lines
998 B
TypeScript

import { API_ROUTES } from '@/constants/apiRoutes';
import type {
DiscardDetectionPayload,
DiscardDetectionResponse,
ReviewDetectionRepairProofPayload,
ReviewDetectionRepairProofResponse,
} from '@/types';
import axiosClient from '../axios/axios';
export const detectionService = {
discardDetection: async (
detectionId: number,
payload: DiscardDetectionPayload,
): Promise<DiscardDetectionResponse> => {
const response = await axiosClient.post<DiscardDetectionResponse>(
API_ROUTES.DETECTIONS.DISCARD(detectionId),
payload,
);
return response.data;
},
reviewRepairProof: async (
ticketId: string,
detectionId: number,
payload: ReviewDetectionRepairProofPayload,
): Promise<ReviewDetectionRepairProofResponse> => {
const response = await axiosClient.post<ReviewDetectionRepairProofResponse>(
API_ROUTES.TICKETS.REVIEW_DETECTION_REPAIR_PROOF(ticketId, detectionId),
payload,
);
return response.data;
},
};