From c09e55f963dae3086e947549e651eae1bd7e6c32 Mon Sep 17 00:00:00 2001 From: Samet Date: Mon, 10 Apr 2023 17:44:38 +0300 Subject: [PATCH] fix(#135): made connects page private --- app/connect/page.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/connect/page.tsx b/app/connect/page.tsx index a558a93..05b4730 100644 --- a/app/connect/page.tsx +++ b/app/connect/page.tsx @@ -1,5 +1,6 @@ import { getServerSession } from "next-auth/next"; import { authOptions } from "@/pages/api/auth/[...nextauth]"; +import { redirect } from "next/navigation"; import prisma from "@/services/prisma"; @@ -18,6 +19,8 @@ export default async function Connect() { const session = await getServerSession(authOptions); let connectionWithPlatforms: IConnectionWithPlatforms[] = []; + if (!session) redirect("/"); + if (session) { connectionWithPlatforms = await prisma.connection.findMany({ where: { userId: session.user.id, type: "oauth" },