Skip to content

Commit c3800ed

Browse files
authored
Merge pull request #308 from Yoshify/fix/post-login-url
fix: postLoginRedirectURL within callback
2 parents 2ac63e2 + 2c4a7fb commit c3800ed

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/handlers/callback.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@ export const callback = async (routerClient: RouterClient) => {
6868
await routerClient.sessionManager.removeSessionItem("state");
6969

7070
if (postLoginRedirectURL && isRedirectAllowed(postLoginRedirectURL)) {
71-
const url = new URL(
72-
`${postLoginRedirectURL.startsWith("http") ? "" : routerClient.clientConfig.siteUrl}`,
73-
postLoginRedirectURL,
74-
);
71+
const url = postLoginRedirectURL.startsWith('http')
72+
? new URL(postLoginRedirectURL)
73+
: new URL(postLoginRedirectURL, routerClient.clientConfig.siteUrl);
7574
state && url.searchParams.set("state", state);
7675
return routerClient.redirect(url.toString());
7776
}

0 commit comments

Comments
 (0)