14 lines
546 B
TypeScript
14 lines
546 B
TypeScript
import type { RoleView } from '@/api/auth';
|
|
|
|
const fallbackWorkbenchRoutes: Record<string, string> = {
|
|
PROJECT_MANAGER: '/workbench/project',
|
|
FINANCE_MANAGER: '/workbench/finance',
|
|
ARCHIVE_MANAGER: '/workbench/archive',
|
|
SYSTEM_ADMIN: '/governance/settings',
|
|
};
|
|
|
|
export function resolveWorkbenchRoute(currentRole: string | null, roles: RoleView[]): string {
|
|
const configured = roles.find((role) => role.code === currentRole)?.workbenchRoute?.trim();
|
|
return configured || fallbackWorkbenchRoutes[currentRole || ''] || '/role-select';
|
|
}
|