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 });

View File

@@ -15,6 +15,9 @@ i18n.addResourceBundle("en", "translation", {
paperlessOffice: "Ethiopian Maritime Authority",
welcomeSubtext: "Sign in to access your maritime services efficiently.",
},
organization: {
"Back to Dashboard": "Back to Dashboard",
},
}, true, true);
createRoot(document.getElementById("root")!).render(

View File

@@ -169,6 +169,12 @@ export const projectTheme: DesignConfig = {
{ label: "activityLog", href: "/user-management/activity_log", icon: "activity", roles: ["super_admin"], isPrimary: false, enabled: true },
{ label: "setting", href: "/user-management/settings", icon: "settings", roles: ["super_admin"], isPrimary: false, enabled: true },
{ label: "Letter Template", href: "/user-management/templates", icon: "file", roles: ["super_admin"], isPrimary: false, enabled: true },
// ── Return to host app ─────────────────────────────────────────────────
// Clicking navigates the HOST (parent window) to the destination. The
// /return/ prefix is intercepted by UserManagementHostPage.tsx to tell the
// host to navigate itself, not the iframe.
{ label: "Back to Dashboard", href: "/return/dashboard", icon: "dashboard", roles: ["admin", "unit_admin", "super_admin"], isPrimary: false, enabled: true },
],
// ── Top tab bar skin (legacy view) ─────────────────────────────────────