tajin_malsou9a
03/28/2022, 9:02 AMEmailPasswordSignUp_Override: ({ DefaultComponent, ...props }) => {
/* if the user visits the /signup route, we want to show the
default implementation. If thy visit the /signin?show=signup
route, we want to show the sign in UI, so we redirect them to /signin
which shows the sign in UI.
*/
const [showUI, setShowUI] = useState(false);
useEffect(() => {
if (window.location.pathname === "/signup") {
setShowUI(true);
} else if (window.location.pathname === "/signin") {
window.location.href = "/signin";
} else {
setShowUI(true);
}
}, []);
if (showUI) {
return <DefaultComponent {...props} />;
} else {
return null;
}
},
is this part of the comment correct? "If thy visit the /signin?show=signup route, we want to show the sign in UI, so we redirect them to /signin which shows the sign in UI."
I'm confusedrp_st
03/28/2022, 9:35 AMshow
.
In the split UI, we are still rendering the same component, but just hiding the sign up UI in the /signin route. So technically, someone can still use the show
query param to navigate to the hidden sign up UI. So in case that happens, we redirect to the right path.tajin_malsou9a
03/28/2022, 9:38 AMtajin_malsou9a
03/28/2022, 9:38 AMSuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).
Powered by