26 lines
782 B
TypeScript
26 lines
782 B
TypeScript
import NavigationShell from "@/components/navigation-shell";
|
|
import AdminDashboard from "@/components/admin-dashboard";
|
|
import { requireAdminUser, toPublicUser } from "@/lib/auth";
|
|
import { getAdminSnapshot } from "@/lib/admin";
|
|
|
|
export default async function AdminPage() {
|
|
const user = await requireAdminUser();
|
|
const publicUser = toPublicUser(user);
|
|
const snapshot = getAdminSnapshot();
|
|
|
|
if (!publicUser) {
|
|
throw new Error("Unable to resolve admin user.");
|
|
}
|
|
|
|
return (
|
|
<NavigationShell
|
|
currentUser={publicUser}
|
|
activePath="/admin"
|
|
title="管理后台"
|
|
description="配置用户角色与额度规则,让管理员无限额、普通用户受控。"
|
|
>
|
|
<AdminDashboard initialSnapshot={snapshot} />
|
|
</NavigationShell>
|
|
);
|
|
}
|