Files
ontime/apps/client/src/common/api/report.ts
T
2026-08-30 13:29:12 +02:00

22 lines
731 B
TypeScript

import axios from 'axios';
import type { LastRunReport } from 'ontime-types';
import { ontimeQueryClient } from '../../common/queryClient';
import { REPORT, apiEntryUrl } from './constants';
import type { RequestOptions } from './requestOptions';
export const reportUrl = `${apiEntryUrl}/report`;
/**
* HTTP request to fetch the one report retained from the latest run.
*/
export async function fetchLastRunReport(options?: RequestOptions): Promise<LastRunReport> {
const res = await axios.get(`${reportUrl}/last-run`, { signal: options?.signal });
return res.data;
}
export async function deleteAllReport() {
await axios.delete(`${reportUrl}/all`);
await ontimeQueryClient.invalidateQueries({ queryKey: REPORT });
}