Skip to content

Commit

Permalink
Simplify API request URL and update statistics base URL
Browse files Browse the repository at this point in the history
  • Loading branch information
HelNershingThapa committed Aug 18, 2023
1 parent 5c554ca commit c6a4bb0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example.env
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/homepage/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/teamsAndOrgs/featureStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/projectStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit c6a4bb0

Please sign in to comment.