diff --git a/packages/tupaia-web/src/api/queries/useReport.ts b/packages/tupaia-web/src/api/queries/useReport.ts index be3f8d2a6b..f0ca61073a 100644 --- a/packages/tupaia-web/src/api/queries/useReport.ts +++ b/packages/tupaia-web/src/api/queries/useReport.ts @@ -24,9 +24,10 @@ export const useReport = (reportCode: DashboardItemType['reportCode'], params: Q const timeZone = getBrowserTimeZone(); const formattedStartDate = formatDateForApi(startDate, null); const formattedEndDate = formatDateForApi(endDate, null); + const endpoint = legacy ? 'legacyDashboardReport' : 'report'; return useQuery( [ - 'report', + endpoint, reportCode, dashboardCode, projectCode, @@ -36,10 +37,9 @@ export const useReport = (reportCode: DashboardItemType['reportCode'], params: Q formattedEndDate, ], () => - get(`report/${reportCode}`, { + get(`${endpoint}/${reportCode}`, { params: { dashboardCode, - legacy, itemCode, projectCode, organisationUnitCode: entityCode,