Skip to content

Commit fd741d0

Browse files
committed
replace useSearchParams in GuestLoginVerificationForm to use searchParams from GuestLogin page
1 parent 0554201 commit fd741d0

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

apps/site/src/app/(main)/guest-login/GuestLogin.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ async function GuestLogin({
77
searchParams,
88
}: {
99
searchParams?: {
10+
email?: string;
1011
return_to?: string;
1112
};
1213
}) {
@@ -20,7 +21,10 @@ async function GuestLogin({
2021
<h1 className="font-display text-3xl md:text-5xl mb-20">
2122
Enter Passphrase
2223
</h1>
23-
<GuestLoginVerificationForm />
24+
<GuestLoginVerificationForm
25+
email={searchParams?.email}
26+
return_to={searchParams?.return_to}
27+
/>
2428
</div>
2529
);
2630
}

apps/site/src/app/(main)/guest-login/components/GuestLoginVerificationForm.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
"use client";
2-
3-
import { useSearchParams } from "next/navigation";
41
import clsx from "clsx";
52

63
import ValidatingForm from "@/lib/components/ValidatingForm/ValidatingForm";
@@ -11,17 +8,19 @@ import styles from "@/lib/components/ValidatingForm/ValidatingForm.module.scss";
118
const VERIFICATION_PATH = "/api/guest/verify";
129
const PASSPHRASE_REGEX = /\w+-\w+-\w+-\w+/;
1310

14-
export default function GuestLoginVerificationForm() {
15-
const searchParams = useSearchParams();
16-
const email = searchParams.get("email");
17-
const return_to = searchParams.get("return_to");
18-
11+
export default function GuestLoginVerificationForm({
12+
email,
13+
return_to,
14+
}: {
15+
email?: string;
16+
return_to?: string;
17+
}) {
1918
if (!email) {
2019
return <p>Error: email was not provided</p>;
2120
}
2221

2322
const newSearchParams = new URLSearchParams();
24-
if (return_to !== null) {
23+
if (return_to) {
2524
newSearchParams.append("return_to", return_to);
2625
}
2726

0 commit comments

Comments
 (0)