From c6a4bb02b1a4b18d302abb24829e0e59ba53f2cc Mon Sep 17 00:00:00 2001 From: Hel Nershing Thapa Date: Thu, 17 Aug 2023 11:40:48 +0545 Subject: [PATCH] Simplify API request URL and update statistics base URL --- example.env | 2 +- frontend/src/components/homepage/stats.js | 2 +- frontend/src/components/teamsAndOrgs/featureStats.js | 2 +- frontend/src/views/projectStats.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example.env b/example.env index c252283c3f..51c2e37818 100644 --- a/example.env +++ b/example.env @@ -86,7 +86,7 @@ OSM_REGISTER_URL=https://www.openstreetmap.org/user/new # API base URL and token(used to retrieve user stats only) for ohsomeNow Stats # -OHSOME_STATS_BASE_URL=https://demo.contributions-stats.ohsome.org/api +OHSOME_STATS_BASE_URL=https://stats.now.ohsome.org/api OHSOME_STATS_TOKEN=testSuperSecretTestToken # Secret (required) diff --git a/frontend/src/components/homepage/stats.js b/frontend/src/components/homepage/stats.js index 3e5a29da35..2bc82b1d36 100644 --- a/frontend/src/components/homepage/stats.js +++ b/frontend/src/components/homepage/stats.js @@ -41,7 +41,7 @@ export const StatsSection = () => { const abortController = new AbortController(); // Using axios over the useFetch hook for external API endpoint const fetchOsmStats = () => - axios.get(`${OHSOME_STATS_BASE_URL}/stats/hotosm-project-%2A?ohsomeFormat=false`, { + axios.get(`${OHSOME_STATS_BASE_URL}/stats/hotosm-project-%2A`, { signal: abortController.signal, }); diff --git a/frontend/src/components/teamsAndOrgs/featureStats.js b/frontend/src/components/teamsAndOrgs/featureStats.js index 51fa826841..3d6b8c07e6 100644 --- a/frontend/src/components/teamsAndOrgs/featureStats.js +++ b/frontend/src/components/teamsAndOrgs/featureStats.js @@ -12,7 +12,7 @@ export const FeatureStats = () => { const getStats = async () => { try { const response = await axios.get( - `${OHSOME_STATS_BASE_URL}/stats/hotosm-project-%2A?ohsomeFormat=false`, + `${OHSOME_STATS_BASE_URL}/stats/hotosm-project-%2A`, ); const { edits, buildings, roads } = response.data.result; setStats({ diff --git a/frontend/src/views/projectStats.js b/frontend/src/views/projectStats.js index c8c64d99a8..a241bb3914 100644 --- a/frontend/src/views/projectStats.js +++ b/frontend/src/views/projectStats.js @@ -41,7 +41,7 @@ export function ProjectStats() { // To fix: set this URL with an ENV VAR later if (defaultComment.length) { fetchExternalJSONAPI( - `${OHSOME_STATS_BASE_URL}/stats/${defaultComment[0].replace('#', '')}?ohsomeFormat=false`, + `${OHSOME_STATS_BASE_URL}/stats/${defaultComment[0].replace('#', '')}`, ) .then((res) => setEdits(res.result)) .catch((e) => console.log(e));