Refactor code

This commit is contained in:
2026-02-03 12:17:47 +01:00
parent ea5eb6fa59
commit 8572e22c5d
185 changed files with 1268 additions and 1458 deletions

View File

@ -1,11 +1,13 @@
import { UsersTable } from "@/components/users/UsersTable";
import { auth } from "@/lib/auth";
import type { SessionWithRole } from "@/types/auth";
import { headers } from "next/headers";
import { redirect } from "next/navigation";
// Admin users list page.
export default async function UsersPage() {
const session = await auth.api.getSession({ headers: await headers() });
const role = (session as any)?.user?.role as string | undefined;
const role = (session as SessionWithRole)?.user?.role;
if (!session) redirect("/login");
if (role !== "admin") redirect("/");