Skip to content

Commit

Permalink
Fix Frontend Test Case failure on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
royallsilwallz committed Mar 29, 2024
1 parent eb19a9a commit bd98592
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions frontend/src/api/stats.js
Original file line number Diff line number Diff line change
@@ -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 = () => {
Expand Down Expand Up @@ -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,
});
};
Expand Down

0 comments on commit bd98592

Please sign in to comment.