Formatting was done.

This commit is contained in:
Owaise Imdad committed 2025-06-17 00:17:46 +05:30
1 parent e9e509ab04
commit 11212c7371
3 files changed
+33 -33

No files matched your search

+28 -28
View File
@@ -454,36 +454,36 @@ const useCreateBulkMonitors = () => {
};
const useExportMonitors = () => {
const [isLoading, setIsLoading] = useState(false);
const { t } = useTranslation();
const [isLoading, setIsLoading] = useState(false);
const { t } = useTranslation();
const exportMonitors = async () => {
setIsLoading(true);
try {
const blob = await networkService.exportMonitors();
// Create a download link
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'monitors.csv');
document.body.appendChild(link);
link.click();
link.remove();
window.URL.revokeObjectURL(url);
createToast({ body: t('export.success') });
return [true, null];
} catch (err) {
const errorMessage = err?.response?.data?.msg || err.message;
createToast({ body: errorMessage || t('export.failed') });
return [false, errorMessage];
} finally {
setIsLoading(false);
}
};
const exportMonitors = async () => {
setIsLoading(true);
try {
const blob = await networkService.exportMonitors();
return [exportMonitors, isLoading];
// Create a download link
const url = window.URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "monitors.csv");
document.body.appendChild(link);
link.click();
link.remove();
window.URL.revokeObjectURL(url);
createToast({ body: t("export.success") });
return [true, null];
} catch (err) {
const errorMessage = err?.response?.data?.msg || err.message;
createToast({ body: errorMessage || t("export.failed") });
return [false, errorMessage];
} finally {
setIsLoading(false);
}
};
return [exportMonitors, isLoading];
};
export {