Skip to content

Commit

Permalink
Fixed export to json tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pkirilin committed Jan 28, 2024
1 parent b35cb6f commit 60ecb8f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/frontend/src/features/pages/hooks/useExportToJson.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useState } from 'react';
import { API_URL } from 'src/config';
import { createUrl, downloadFile, formatDate } from 'src/utils';
import { type ExportPagesToJsonRequest } from '../models';

Expand All @@ -18,6 +19,7 @@ export const useExportToJson = (
useEffect(() => {
if (exportFileDownloaded) {
onSuccess();
setExportFileDownloaded(false);
}
}, [exportFileDownloaded, onSuccess]);

Expand All @@ -31,10 +33,11 @@ export const useExportToJson = (
endDate: formatDate(endDate),
};

const url = createUrl('/api/v1/exports/json', { ...request });
const url = createUrl(`${API_URL}/api/v1/exports/json`, { ...request });
const response = await fetch(url);

if (!response.ok) {
setExportFileDownloading(false);
setExportFileDownloaded(false);
return;
}
Expand Down

0 comments on commit 60ecb8f

Please sign in to comment.