Skip to content

Commit

Permalink
refactor: Simplify getTaxonomyListApiUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
yusuf-musleh committed Nov 17, 2023
1 parent 43b2de5 commit dd9ef5a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/taxonomy/data/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
const getApiBaseUrl = () => getConfig().STUDIO_BASE_URL;

export const getTaxonomyListApiUrl = (org) => {
let queryParams = '?enabled=true';
const url = new URL('api/content_tagging/v1/taxonomies/', getApiBaseUrl());
url.searchParams.append('enabled', 'true');
if (org !== undefined) {
queryParams = `${queryParams}&org=${org}`;
url.searchParams.append('org', org);
}
return new URL(`api/content_tagging/v1/taxonomies/${queryParams}`, getApiBaseUrl()).href;
return url.href;
};

export const getExportTaxonomyApiUrl = (pk, format) => new URL(
Expand Down

0 comments on commit dd9ef5a

Please sign in to comment.