Skip to content

Commit

Permalink
refactor: use same path sufix
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Apr 12, 2024
1 parent f4cf7fd commit 53d70e3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/search-modal/SearchResult.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,13 @@ const ItemIcon = {
const getContextUrl = (hit, newWindow, libraryAuthoringMfeUrl) => {
const { context_key: contextKey, usage_key: usageKey } = hit;
if (contextKey.startsWith('course-v1:')) {
const courseSufix = `course/${contextKey}?show=${encodeURIComponent(usageKey)}`;
if (newWindow) {
return `${getPath(getConfig().PUBLIC_PATH)}course/${contextKey}?show=${encodeURIComponent(usageKey)}`;
return `${getPath(getConfig().PUBLIC_PATH)}${courseSufix}`;
}
return `/course/${contextKey}?show=${encodeURIComponent(usageKey)}`;
return `/${courseSufix}`;
}
if (usageKey.includes('lb:')) {
if (usageKey.startsWith('lb:')) {
return `${libraryAuthoringMfeUrl}library/${contextKey}`;
}
return '#';
Expand Down

0 comments on commit 53d70e3

Please sign in to comment.