fix: check if user is logged in before checking for punishments
This commit is contained in:
parent
f8838caa55
commit
62f33440f3
1 changed files with 9 additions and 7 deletions
|
|
@ -40,6 +40,7 @@ export default async function Page({ searchParams }: Props) {
|
||||||
if (session?.user && !session.user.username) {
|
if (session?.user && !session.user.username) {
|
||||||
redirect("/create-username");
|
redirect("/create-username");
|
||||||
}
|
}
|
||||||
|
if (session?.user) {
|
||||||
const activePunishment = await prisma.punishment.findFirst({
|
const activePunishment = await prisma.punishment.findFirst({
|
||||||
where: {
|
where: {
|
||||||
userId: Number(session?.user.id),
|
userId: Number(session?.user.id),
|
||||||
|
|
@ -47,6 +48,7 @@ export default async function Page({ searchParams }: Props) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (activePunishment) redirect("/off-the-island");
|
if (activePunishment) redirect("/off-the-island");
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue