mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-02-23 10:42:00 +00:00
14 lines
323 B
TypeScript
14 lines
323 B
TypeScript
|
import { auth } from "@/lib/auth";
|
||
|
import { redirect } from "next/navigation";
|
||
|
import { headers } from "next/headers";
|
||
|
|
||
|
const session = await auth.api.getSession({
|
||
|
headers: await headers(),
|
||
|
});
|
||
|
export async function AdminAuthGuard() {
|
||
|
if (session?.user.role !== "ADMIN") {
|
||
|
return redirect("/login");
|
||
|
}
|
||
|
return true;
|
||
|
}
|