Skip to content

Commit

Permalink
feat: add v2 just for marketplace-api
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmahidalgo committed Oct 28, 2024
1 parent 862fb9a commit b250b2a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion webapp/src/modules/vendor/decentraland/catalog/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export class CatalogAPI extends BaseClient {
async get(filters: CatalogFilters = {}, options?: { v2?: boolean; headers?: Record<string, string> }): Promise<{ data: Item[] }> {
const queryParams = this.buildItemsQueryString(filters)
const { headers, v2 = false } = options || {}
return this.fetch(`/${v2 ? 'v2' : 'v1'}/catalog?${queryParams}`, {
const isUsingMarketplaceAPI = this.baseUrl.includes('marketplace-api')
// the V2 endpoint is only available in the marketplace API
return this.fetch(`/${v2 && isUsingMarketplaceAPI ? 'v2' : 'v1'}/catalog?${queryParams}`, {
headers
})
}
Expand Down

0 comments on commit b250b2a

Please sign in to comment.