Files
smart-go/web/app/(main)/(iam)/dept/page.tsx
T
2026-04-23 18:58:13 +08:00

20 lines
761 B
TypeScript

'use client';
import { DeptTreeView } from '@/components/iam/DeptTreeView';
import { IamSectionCard } from '@/components/iam/IamSectionCard';
import { useApi } from '@/lib/hooks/use-api';
import { iamDept } from '@/lib/api/iam';
import type { DeptNode } from '@/lib/api/types/dept';
export default function IamDeptPage() {
const { data, loading, error } = useApi<DeptNode[]>(() => iamDept.tree());
return (
<IamSectionCard title="部门管理" description="对接 GET /api/v1/iam/dept/tree。">
{loading ? <p className="text-sm text-neutral-500"></p> : null}
{error ? <p className="text-sm text-red-600">{error}</p> : null}
{!loading && !error && data ? <DeptTreeView tree={data} /> : null}
</IamSectionCard>
);
}