abhaybisht2002
02/19/2024, 10:41 AMjs
export function setRouter(router: ReturnType<typeof useRouter>, pathName: string) {
routerInfo.router = router;
routerInfo.pathName = pathName;
}
export const frontendConfig = (): SuperTokensConfig => {
return {
appInfo,
recipeList: [
ThirdPartyEmailPasswordReact.init({
signInAndUpFeature: {
providers: [
ThirdPartyEmailPasswordReact.Google.init(),
ThirdPartyEmailPasswordReact.Github.init(),
],
},
getRedirectionURL: async (context) => {
if (context.action === "SUCCESS") {
if (context.redirectToPath !== undefined) {
// we are navigating back to where the user was before they authenticated
return context.redirectToPath;
}
if (context.isNewPrimaryUser) {
// user signed up
redirectToAuth({ show: "signin" })
return ""
} else {
// user signed in
return "/create-organization"
}
} else {
redirectToAuth({ show: "signin" });
return ""
}
},