- added download button
- added reads for number plate sightings
This commit is contained in:
20
src/features/dashboard/hooks/useDownloadLogFiles.ts
Normal file
20
src/features/dashboard/hooks/useDownloadLogFiles.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
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 };
|
||||
};
|
||||
Reference in New Issue
Block a user