Files
BayIQ-UI/src/features/dashboard/hooks/useDownloadLogFiles.ts
Toba Ojo f7964d4fc0 - added download button
- added reads for number plate sightings
2025-12-03 10:46:36 +00:00

21 lines
559 B
TypeScript

import { useQuery } from "@tanstack/react-query";
import { CAMBASE } from "../../../utils/config";
const getDownloadLogFiles = async () => {
const response = await fetch(`${CAMBASE}/LogView/download?filename=FlexiAI-0.log`);
if (!response.ok) {
throw new Error("Failed to download log files");
}
return response.blob();
};
export const useDownloadLogFiles = () => {
const downloadLogFilesQuery = useQuery({
queryKey: ["downloadLogFiles"],
queryFn: getDownloadLogFiles,
enabled: false,
});
return { downloadLogFilesQuery };
};