update the usermanagement link

This commit is contained in:
mengstabketemaw
2026-06-15 10:21:35 +03:00
parent bd6fd97111
commit db861fca42
3 changed files with 19 additions and 2 deletions

View File

@@ -19,7 +19,7 @@ import { useNavigate, useLocation } from 'react-router-dom';
function readToken(): string | null {
return (
localStorage.getItem('fhc-backoffice-auth-token') ??
localStorage.getItem('ema-backoffice-auth-token') ??
(() => {
const escaped = 'auth-token'.replace(/([.$?*|{}()[\]\\/+^])/g, '\\$1');
const match = document.cookie.match(new RegExp('(?:^|; )' + escaped + '=([^;]*)'));
@@ -29,7 +29,7 @@ function readToken(): string | null {
}
function readRefreshToken(): string | null {
return localStorage.getItem('fhc-backoffice-auth-refresh-token') ?? null;
return localStorage.getItem('ema-backoffice-refresh-token') ?? null;
}
export default function UserManagementHostPage() {
@@ -68,6 +68,14 @@ export default function UserManagementHostPage() {
}
if (data.type === 'UM_ROUTE_CHANGED' && typeof data.path === 'string') {
// Allow the module to navigate the host away by using /return/<path>.
// Add a nav item with href: "/return/dashboard" in project.theme.ts
// navItems to send the user back to the host app.
const returnMatch = data.path.match(/^\/return\/(.+)/);
if (returnMatch) {
navigate('/' + returnMatch[1], { replace: true });
return;
}
const target = '/um' + data.path;
if (window.location.pathname + window.location.search !== target) {
navigate(target, { replace: true });