25 lines
723 B
TypeScript
25 lines
723 B
TypeScript
import type { Metadata } from "next";
|
|
import { redirect } from "next/navigation";
|
|
import { getServerSession } from "next-auth";
|
|
import { authOptions } from "@/lib/auth";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Daftar Akun",
|
|
description:
|
|
"Buat akun SeTrip gratis. Cari open trip & aktivitas bareng, gabung bareng, dan mulai petualanganmu.",
|
|
alternates: { canonical: "/register" },
|
|
};
|
|
|
|
export default async function RegisterLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
// User yang sudah login tidak boleh mengakses halaman daftar lagi.
|
|
const session = await getServerSession(authOptions);
|
|
if (session?.user) {
|
|
redirect(session.user.isAdmin ? "/admin" : "/");
|
|
}
|
|
return children;
|
|
}
|