Files
model-platform/frontend/app/routes/system-roles.tsx
T
2026-09-02 10:10:41 +08:00

24 lines
925 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { useAuth } from "~/context/AuthContext";
import { useScriptWorkspaceStore } from "~/features/platform/state/scriptWorkspaceStore";
import { useUiStore } from "~/features/platform/state/uiStore";
import { RoleManagementPage } from "~/features/admin/RoleManagementPage";
/**
* /system/roles 路由页。RoleManagementPage 内部有 useState
* 在 user / workspace 切换时必须重挂载以重置本地状态
* (见 CLAUDE.md「Route components with their own internal state」)。
*/
export default function RoleManagementRoute() {
const { user, currentWorkspace } = useAuth();
const setApiOnline = useScriptWorkspaceStore((s) => s.setApiOnline);
const pushToast = useUiStore((s) => s.pushToast);
return (
<RoleManagementPage
key={`${user?.user_id ?? "anon"}-${currentWorkspace?.workspace_id ?? "none"}`}
onNotify={pushToast}
onConnectionChange={setApiOnline}
/>
);
}