Invite prefill email (#43)

* Add prepopulation of email field in sign-up form
* Updated packages
This commit is contained in:
Giancarlo Buomprisco
2024-07-11 13:59:14 +08:00
committed by GitHub
parent 4f0e6b9bbb
commit 21f42f14ce
24 changed files with 151 additions and 85 deletions

View File

@@ -20,6 +20,7 @@ import { withI18n } from '~/lib/i18n/with-i18n';
interface Context {
searchParams: {
invite_token?: string;
email?: string;
};
}
@@ -46,9 +47,15 @@ async function JoinTeamAccountPage({ searchParams }: Context) {
// redirect to the sign up page with the invite token
// so that they will get back to this page after signing up
if (auth.error ?? !auth.data) {
const path = `${pathsConfig.auth.signUp}?invite_token=${token}`;
const urlParams = new URLSearchParams({
invite_token: token,
email: searchParams.email ?? '',
});
redirect(path);
const signUpPath = `${pathsConfig.auth.signUp}?${urlParams.toString()}`;
// redirect to the sign up page with the invite token
redirect(signUpPath);
}
// get api to interact with team accounts