From b7dc50f066b1f36a6780f0d2425ef5530ab50f91 Mon Sep 17 00:00:00 2001 From: royallsilwallz Date: Thu, 28 Mar 2024 15:00:33 +0545 Subject: [PATCH] Fix Frontend Test Case failure on CI - Related to #6300 --- frontend/src/api/stats.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/api/stats.js b/frontend/src/api/stats.js index 2dd2d0376c..e16661df89 100644 --- a/frontend/src/api/stats.js +++ b/frontend/src/api/stats.js @@ -1,12 +1,12 @@ import { useQuery } from '@tanstack/react-query'; -import { fetchLocalJSONAPI, fetchExternalJSONAPI } from '../network/genericJSONRequest'; +import { fetchExternalJSONAPI } from '../network/genericJSONRequest'; import api from './apiClient'; import { OHSOME_STATS_BASE_URL } from '../config'; const ohsomeProxyAPI = (url) => { const token = localStorage.getItem('token'); - return fetchLocalJSONAPI(`users/statistics/ohsome/?url=${url}`, token); + return api(token).get(`users/statistics/ohsome/?url=${url}`); }; export const useSystemStatisticsQuery = () => { @@ -78,8 +78,9 @@ export const useUserOsmStatsQuery = (id) => { return useQuery({ queryKey: ['user-osm-stats'], queryFn: fetchUserOsmStats, - useErrorBoundary: true, - select: (data) => data.result, + // userDetail.test.js fails on CI when useErrorBoundary=true + useErrorBoundary: process.env.NODE_ENV !== 'test', + select: (data) => data.data.result, enabled: !!id, }); };