mirror of
https://github.com/Such-Software/xmrcheckout.git
synced 2026-10-17 05:51:34 +02:00
- POST/GET/DELETE /api/admin/users endpoints - Admin UI at /admin with login, user list, create/delete - Auth via ADMIN_API_KEY env var (separate from tenant auth) - Tenants remain scoped to their own store only
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { cookies } from "next/headers";
|
|
import { fetchAdminUsers } from "./actions";
|
|
import { AdminLoginForm } from "./admin-login-form";
|
|
import { AdminPanel } from "./admin-panel";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export default async function AdminPage() {
|
|
const cookieStore = await cookies();
|
|
const adminKey = cookieStore.get("xmrcheckout_admin_key")?.value;
|
|
|
|
if (!adminKey) {
|
|
return (
|
|
<div className="min-h-screen flex items-center justify-center px-4">
|
|
<div className="w-full max-w-md">
|
|
<h1 className="text-2xl font-bold mb-6 text-center">Admin</h1>
|
|
<AdminLoginForm />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const users = await fetchAdminUsers();
|
|
|
|
if (users === null) {
|
|
return (
|
|
<div className="min-h-screen flex items-center justify-center px-4">
|
|
<div className="w-full max-w-md">
|
|
<h1 className="text-2xl font-bold mb-6 text-center">Admin</h1>
|
|
<p className="text-center text-red-500 mb-4">Invalid or expired admin key.</p>
|
|
<AdminLoginForm />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return <AdminPanel users={users} />;
|
|
}
|