Skip to content

Commit

Permalink
Merge pull request #140 from sametcodes/135-connections-page-should-b…
Browse files Browse the repository at this point in the history
…e-available-only-to-logged-in-users

fix(#135): made connects page private
  • Loading branch information
sametcodes authored Apr 10, 2023
2 parents 5c2853f + c09e55f commit 13680e8
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 13680e8

Please sign in to comment.