Skip to content

Commit

Permalink
fix switch context
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanjpburgos committed Feb 26, 2025
1 parent 2219902 commit 66e9ee9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ui/internal-page/ContextSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ const ContextSelect = ({ intl }) => (
if (currentContext === e.target.value) return;
const selectedContext = e.target.value === 'ROOT' ? '' : e.target.value;
setEntandoVirtualContextInCookies(selectedContext);
window.location.pathname = window.location.pathname.replace(`/${currentContext}`, selectedContext === '' ? '' : `/${selectedContext}/`);
const pathFragments = window.location.pathname.split('/');
const publicUrlIndex = pathFragments.findIndex(el => el === process.env.PUBLIC_URL.replace('/', ''));
pathFragments[publicUrlIndex + 1] = selectedContext;
window.location.pathname = pathFragments.filter(el => el !== '').join('/');
}}
>
{
Expand Down

0 comments on commit 66e9ee9

Please sign in to comment.