Skip to content

Commit

Permalink
fix(#135): made connects page private
Browse files Browse the repository at this point in the history
  • Loading branch information
sametcodes committed Apr 10, 2023
1 parent 48b2763 commit c09e55f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/connect/page.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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" },
Expand Down

0 comments on commit c09e55f

Please sign in to comment.