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 authored and CodeWithEmad committed Nov 19, 2024
1 parent 4581cf8 commit 76f4143
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 76f4143

Please sign in to comment.