sign up redirect fix

This commit is contained in:
bflatastic committed 2024-09-02 23:43:02 +07:00
1 parent ffa8b70e23
commit f8bf7c0710
1 file changed
+6 -12
@@ -264,17 +264,6 @@ function SignupPage(props: Props) {
let redirectLink = queryParams.get("redirect");
const redirectSignUpLink = "/welcome";
if (redirectLink) {
try {
const url = new URL(redirectLink);
url.searchParams.set("from", "signup");
redirectLink = url.toString();
} catch (error) {
console.error("Invalid redirect URL:", redirectLink);
redirectLink = null;
}
}
const afterSignupRedirect = async () => {
const maybeInternalPlanKey = parsedQueryString["sub"] as string | undefined;
@@ -284,7 +273,12 @@ function SignupPage(props: Props) {
}
}
let redirectUrl = redirectLink || WebUrl.pricingPageWithReferer("signup");
let redirectUrl = redirectLink
? redirectLink.includes("?")
? redirectLink + "&from=signup"
: redirectLink + "?from=signup"
: WebUrl.pricingPageWithReferer("signup");
if (domain.titlePart === "Storyteller AI") {
redirectUrl = redirectSignUpLink;
if (redirectUrl === redirectSignUpLink) {