From 6f7cc79febb30b1cf178daae91bd94730cb4262d Mon Sep 17 00:00:00 2001 From: Nicholas Chiang Date: Sun, 23 Jul 2023 01:42:17 -0600 Subject: [PATCH] fix: pass `redirectTo` between login and sign up This patch updates the login and sign up routes to forward their `redirectTo` search parameter when navigating between the two. That way, users can click the "No account? Sign up here" link and still be redirected to their ultimate destination if applicable. This patch also does some minor import refactoring (put the `type` inside the `import` statement). --- app/routes/_layout.join.tsx | 14 +++++++++++--- app/routes/_layout.login.tsx | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/app/routes/_layout.join.tsx b/app/routes/_layout.join.tsx index a2a031c9..cd7e005a 100644 --- a/app/routes/_layout.join.tsx +++ b/app/routes/_layout.join.tsx @@ -7,8 +7,13 @@ import { useSearchParams, useNavigation, } from '@remix-run/react' -import type { ActionArgs, LoaderArgs, V2_MetaFunction } from '@vercel/remix' -import { json, redirect } from '@vercel/remix' +import { + type ActionArgs, + type LoaderArgs, + type V2_MetaFunction, + json, + redirect, +} from '@vercel/remix' import { z } from 'zod' import { @@ -128,7 +133,10 @@ export default function Join() {

Sign up

Already have an account?{' '} - + Login here.

diff --git a/app/routes/_layout.login.tsx b/app/routes/_layout.login.tsx index 2430b9cf..967f0213 100644 --- a/app/routes/_layout.login.tsx +++ b/app/routes/_layout.login.tsx @@ -7,8 +7,13 @@ import { useSearchParams, useNavigation, } from '@remix-run/react' -import type { ActionArgs, LoaderArgs, V2_MetaFunction } from '@vercel/remix' -import { json, redirect } from '@vercel/remix' +import { + type ActionArgs, + type LoaderArgs, + type V2_MetaFunction, + json, + redirect, +} from '@vercel/remix' import { z } from 'zod' import { @@ -91,7 +96,10 @@ export default function LoginPage() {

Login

Don’t have an account?{' '} - + Sign up here.