Skip to content

Commit a3b0834

Browse files
adityathebemoshloop
authored andcommitted
fix(clerk): redirect_to
1 parent 504bf5b commit a3b0834

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/components/Authentication/Clerk/ClerkLogin.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ import { useRouter } from "next/router";
44
export default function ClerkLogin() {
55
const { query } = useRouter();
66

7-
const redirectUrl = query.redirectUrl
8-
? (query.return_to as string)
9-
: undefined;
7+
const returnTo = query.return_to as string;
108

119
return (
1210
<SignIn
1311
path="/login"
1412
routing="path"
1513
signUpUrl="/registration"
16-
forceRedirectUrl={`/?return_to=${redirectUrl}`}
14+
forceRedirectUrl={returnTo ? `/?return_to=${returnTo}` : undefined}
1715
/>
1816
);
1917
}

src/components/Authentication/Clerk/ClerkRegistration.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
44
export default function ClerkRegistration() {
55
const { query } = useRouter();
66

7-
const redirectUrl = query.redirectUrl ? query.return_to : undefined;
7+
const returnTo = query.return_to as string;
88

99
return (
1010
<div className="flex w-full flex-col px-3 text-center">
@@ -15,7 +15,7 @@ export default function ClerkRegistration() {
1515
routing="path"
1616
signInUrl="/login"
1717
signInForceRedirectUrl={
18-
redirectUrl ? `/?return_to=${redirectUrl}` : undefined
18+
returnTo ? `/?return_to=${returnTo}` : undefined
1919
}
2020
/>
2121
</div>

0 commit comments

Comments
 (0)