From 625c09e1057f72af9892c5b7f1a0db461670e6e6 Mon Sep 17 00:00:00 2001 From: Atridad Lahiji <88056492+atridadl@users.noreply.github.com> Date: Wed, 31 May 2023 16:49:11 -0600 Subject: [PATCH] Added the same redirect logic to /admin --- src/pages/admin/index.tsx | 4 ++-- src/pages/profile/index.tsx | 2 +- src/pages/room/[id].tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/admin/index.tsx b/src/pages/admin/index.tsx index 0f76bb6..446a0f7 100644 --- a/src/pages/admin/index.tsx +++ b/src/pages/admin/index.tsx @@ -13,11 +13,11 @@ import type { Role } from "~/utils/types"; export const getServerSideProps: GetServerSideProps = async (ctx) => { const session = await getServerAuthSession(ctx); - // Redirect to home if not logged in + // Redirect to login if not signed in if (!session) { return { redirect: { - destination: "/", + destination: `/api/auth/signin?callbackUrl=${ctx.resolvedUrl}`, permanent: false, }, }; diff --git a/src/pages/profile/index.tsx b/src/pages/profile/index.tsx index 69b87c6..5d5e90f 100644 --- a/src/pages/profile/index.tsx +++ b/src/pages/profile/index.tsx @@ -14,7 +14,7 @@ import { FaGithub, FaGoogle } from "react-icons/fa"; export const getServerSideProps: GetServerSideProps = async (ctx) => { const session = await getServerAuthSession(ctx); - // Redirect to home if not logged in + // Redirect to login if not signed in if (!session) { return { redirect: { diff --git a/src/pages/room/[id].tsx b/src/pages/room/[id].tsx index 5853123..4a4e21f 100644 --- a/src/pages/room/[id].tsx +++ b/src/pages/room/[id].tsx @@ -33,7 +33,7 @@ import { downloadCSV } from "~/utils/helpers"; export const getServerSideProps: GetServerSideProps = async (ctx) => { const session = await getServerAuthSession(ctx); - // Redirect to home if not logged in + // Redirect to login if not signed in if (!session) { return { redirect: {