Skip to content

Commit

Permalink
fix: apply getPath to PUBLIC_PATH to allow use with CDN
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoa committed Sep 17, 2024
1 parent 7003b61 commit 90f8523
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/data/constants/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getConfig } from '@edx/frontend-platform';
import { getConfig, getPath } from '@edx/frontend-platform';

export const routePath = () => `${getConfig().PUBLIC_PATH}:courseId`;
export const locationId = () => decodeURIComponent(window.location.pathname).replace(getConfig().PUBLIC_PATH, '');
const publicPath = getPath(getConfig().PUBLIC_PATH);
export const routePath = () => `${publicPath}:courseId`;
export const locationId = () => decodeURIComponent(window.location.pathname).replace(publicPath, '');
1 change: 1 addition & 0 deletions src/data/constants/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ jest.unmock('./app');
jest.mock('@edx/frontend-platform', () => {
const PUBLIC_PATH = '/test-public-path/';
return {
...jest.requireActual('@edx/frontend-platform'),
getConfig: () => ({ PUBLIC_PATH }),
PUBLIC_PATH,
};
Expand Down

0 comments on commit 90f8523

Please sign in to comment.