32 lines
890 B
TypeScript
32 lines
890 B
TypeScript
import { AdminDashboardPageQuery } from '@/lib/page-queries/AdminDashboardPageQuery';
|
|
import { AdminDashboardWrapper } from './AdminDashboardWrapper';
|
|
import { ErrorBanner } from '@/ui/ErrorBanner';
|
|
|
|
export default async function AdminPage() {
|
|
const result = await AdminDashboardPageQuery.execute();
|
|
|
|
if (result.isErr()) {
|
|
const error = result.getError();
|
|
if (error === 'notFound') {
|
|
return (
|
|
<ErrorBanner
|
|
title="Access Denied"
|
|
message="You must be logged in as an Owner or Admin"
|
|
variant="error"
|
|
/>
|
|
);
|
|
}
|
|
return (
|
|
<ErrorBanner
|
|
title="Load Failed"
|
|
message={`Failed to load dashboard: ${error}`}
|
|
variant="error"
|
|
/>
|
|
);
|
|
}
|
|
|
|
const output = result.unwrap();
|
|
|
|
// Pass to client wrapper for UI interactions
|
|
return <AdminDashboardWrapper initialViewData={output} />;
|
|
} |