1export interface ClerkSignInProps {
2 forceRedirectUrl?: string;
3 signUpForceRedirectUrl?: string;
4}
5
6export function resolveClerkSignInProps(href: string, isElectron: boolean): ClerkSignInProps {
7 if (isElectron) {
8 // Electron routes through the hash, so reset any Clerk virtual pathname without losing the T3 page.
9 const redirectUrl = new URL(href);
10 redirectUrl.pathname = "/";
11 redirectUrl.search = "";
12
13 return {
14 forceRedirectUrl: redirectUrl.toString(),
15 signUpForceRedirectUrl: redirectUrl.toString(),
16 };
17 }
18 // The sign-in modal can switch to sign-up, which follows its own redirect
19 // target; without one Clerk falls back to the URL the modal was opened from.
20 return { forceRedirectUrl: href, signUpForceRedirectUrl: href };
21}