diff --git a/app/dashboard/interviews/page.tsx b/app/dashboard/interviews/page.tsx index 397ff17d..d90d3ab6 100644 --- a/app/dashboard/interviews/page.tsx +++ b/app/dashboard/interviews/page.tsx @@ -7,7 +7,7 @@ import { requirePageAuth } from '~/utils/auth'; export default async function InterviewPage() { await requireAppNotExpired(); - await requirePageAuth(); + await requirePageAuth({ redirectPath: '/dashboard/interviews' }); return ( <> diff --git a/app/dashboard/layout.tsx b/app/dashboard/layout.tsx index d24f4ab3..f39eee80 100644 --- a/app/dashboard/layout.tsx +++ b/app/dashboard/layout.tsx @@ -12,7 +12,7 @@ export const dynamic = 'force-dynamic'; const Layout = async ({ children }: { children: React.ReactNode }) => { await requireAppNotExpired(); - await requirePageAuth(); + await requirePageAuth({ redirectPath: '/dashboard' }); return ( <> diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index 964299d8..5a20df30 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -17,7 +17,7 @@ export default async function Home({ searchParams: Record; }) { await requireAppNotExpired(); - await requirePageAuth(); + await requirePageAuth({ redirectPath: '/dashboard' }); searchParamsCache.parse(searchParams); diff --git a/app/dashboard/participants/page.tsx b/app/dashboard/participants/page.tsx index 14352f83..11fa6cf5 100644 --- a/app/dashboard/participants/page.tsx +++ b/app/dashboard/participants/page.tsx @@ -8,7 +8,7 @@ import { requirePageAuth } from '~/utils/auth'; export default async function ParticipantPage() { await requireAppNotExpired(); - await requirePageAuth(); + await requirePageAuth({ redirectPath: '/dashboard/participants' }); return ( <> diff --git a/app/dashboard/protocols/page.tsx b/app/dashboard/protocols/page.tsx index 2e764376..9db03336 100644 --- a/app/dashboard/protocols/page.tsx +++ b/app/dashboard/protocols/page.tsx @@ -7,7 +7,7 @@ import { requirePageAuth } from '~/utils/auth'; export default async function ProtocolsPage() { await requireAppNotExpired(); - await requirePageAuth(); + await requirePageAuth({ redirectPath: '/dashboard/protocols' }); return ( <> diff --git a/app/dashboard/settings/page.tsx b/app/dashboard/settings/page.tsx index 84d3fc15..5a7c35f6 100644 --- a/app/dashboard/settings/page.tsx +++ b/app/dashboard/settings/page.tsx @@ -15,7 +15,7 @@ import { requirePageAuth } from '~/utils/auth'; export default async function Settings() { await requireAppNotExpired(); - await requirePageAuth(); + await requirePageAuth({ redirectPath: '/dashboard/settings' }); const installationIdPromise = getInstallationId(); diff --git a/utils/auth.ts b/utils/auth.ts index b1db0c00..f6c8ebe8 100644 --- a/utils/auth.ts +++ b/utils/auth.ts @@ -82,7 +82,7 @@ export async function requirePageAuth( redirect('/signin'); } - redirect('/signin'); + redirect('/signin?callbackUrl=' + encodeURIComponent(redirectPath)); } return session; }