import { useAuth } from "react-oidc-context"; import { Navigate, Outlet } from "react-router-dom"; import { t } from "../../lib/i18n"; import { resolveProfileRole } from "../../lib/role"; export default function AuthGuard() { const auth = useAuth(); if (auth.isLoading || auth.activeNavigator) { return
Loading...
; } if (auth.error) { return
Auth Error: {auth.error.message}
; } if (!auth.isAuthenticated) { return ; } const normalizedRole = resolveProfileRole( auth.user?.profile as Record | undefined, ); const isTenantMember = normalizedRole === "user" || normalizedRole === "tenant_member"; if (isTenantMember) { return (

{t("msg.dev.auth.access_denied_title", "접근 권한이 없습니다.")}

{t( "msg.dev.auth.access_denied_description", "DevFront는 관리자 전용 화면입니다. 권한이 필요하면 관리자에게 요청해 주세요.", )}

); } return ; }