refactor(report): improve report summary

This commit is contained in:
Carlos Valente
2026-08-25 21:57:15 +02:00
committed by Carlos Valente
parent bc6a321172
commit afc3a44455
22 changed files with 1422 additions and 200 deletions
+3 -8
View File
@@ -1,5 +1,5 @@
import axios from 'axios';
import { OntimeReport } from 'ontime-types';
import type { ReportData } from 'ontime-types';
import { ontimeQueryClient } from '../../common/queryClient';
import { REPORT, apiEntryUrl } from './constants';
@@ -8,18 +8,13 @@ import type { RequestOptions } from './requestOptions';
export const reportUrl = `${apiEntryUrl}/report`;
/**
* HTTP request to fetch all reports
* HTTP request to fetch the report
*/
export async function fetchReport(options?: RequestOptions): Promise<OntimeReport> {
export async function fetchReport(options?: RequestOptions): Promise<ReportData> {
const res = await axios.get(reportUrl, { signal: options?.signal });
return res.data;
}
export async function deleteReport(id: string) {
await axios.delete(`${reportUrl}/${id}`);
await ontimeQueryClient.invalidateQueries({ queryKey: REPORT });
}
export async function deleteAllReport() {
await axios.delete(`${reportUrl}/all`);
await ontimeQueryClient.invalidateQueries({ queryKey: REPORT });