Initial commit: JuanitoSport - Muay Thai & Yog4Fight PWA
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { getServerSession } from "next-auth";
|
||||
import { authOptions } from "@/lib/auth";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default async function MemberIndex() {
|
||||
const session = await getServerSession(authOptions);
|
||||
|
||||
if (!session?.user) {
|
||||
redirect("/login");
|
||||
}
|
||||
|
||||
const role = session.user.role;
|
||||
const isMuayThai = session.user.isMuayThai;
|
||||
|
||||
if (role === "ADMIN") {
|
||||
redirect("/admin");
|
||||
} else if (isMuayThai) {
|
||||
redirect("/member/muay-thai");
|
||||
} else {
|
||||
redirect("/member/yoga");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user