add redirect support to signup and verify email

This commit is contained in:
Milo Schwartz 2024-10-13 16:00:49 -04:00
parent 7bfa17a293
commit f14fb90ab6
No known key found for this signature in database
5 changed files with 47 additions and 15 deletions

View file

@ -70,12 +70,18 @@ export default function LoginForm({ redirect }: LoginFormProps) {
setError(null);
if (res.data?.data?.emailVerificationRequired) {
router.push("/auth/verify-email");
if (redirect) {
router.push(`/auth/verify-email?redirect=${redirect}`);
} else {
router.push("/auth/verify-email");
}
return;
}
if (redirect && typeof redirect === "string") {
if (redirect && redirect.includes("http")) {
window.location.href = redirect;
} else if (redirect) {
router.push(redirect);
} else {
router.push("/");
}