Skip to content

Conversation

@suzit-10
Copy link
Contributor

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation
  • πŸ§‘β€πŸ’» Refactor
  • βœ… Test
  • πŸ€– Build or CI
  • ❓ Other (please specify)

Describe this PR

This PR cleans up redundant /api/v2/ prefixes across API endpoints, following up on #6938
contributed by @jake-low.

Background
In #6938, @jake-low removed hardcoded /api/v2 prefixes to support non-standard backend URLs. While that PR fixed the main issue, there were additional occurrences of /api/v2/ prefixes across the codebase. This PR rebases and extends their work, applying the cleanup consistently.

Technical Note
The URL constructor merges relative paths with the base URL automatically:

const url = new URL('/api/v1/', 'https://tasks.hotosm.org');
const newUrl = new URL('/api/v1/projects/', url);

console.log(newUrl.href);
// https://tasks.hotosm.org/api/v1/projects/

Even when both the base and relative path include /api/v1/, the final URL is correct.
This ensures that removing the redundant prefixes is safe, and no changes to fetchLocalJSONAPI() were required.

Changes

  • Removed all redundant /api/v2/ prefixes across the codebase.
  • Verified all API calls continue to work as expected.

Outcome

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants