Sekai
04/19/2023, 9:08 PMexport const frontendConfig = () => {
return {
appInfo,
recipeList: [
EmailPasswordReact.init({
onHandleEvent: async (context) => {
if (context.action === "SESSION_ALREADY_EXISTS") {
// TODO:
console.log("Session already exists")
} else {
if (context.action === "SUCCESS") {
if (context.isNewUser) {
// TODO: Sign up
console.log("User signed up")
createRole()
addRoleToUser(context.user.id)
} else {
console.log("User signed in")
// TODO: Sign in
}
}
}
}
}),
SessionReact.init(),
],
EDIT: now I am getting an error of
Initialization not done. Did you forget to call the UserRoles.init or SuperTokens.init functions. and I did in the backend config. when I put it in frontend config it breaks the code so I don't have it.rp
04/20/2023, 6:37 AMSekai
04/20/2023, 3:20 PMrp
04/20/2023, 3:20 PMSekai
04/20/2023, 4:35 PMrp
04/20/2023, 4:45 PMSekai
04/20/2023, 4:46 PMrp
04/20/2023, 5:17 PMSekai
04/20/2023, 5:32 PMhttps://cdn.discordapp.com/attachments/1098354365221314680/1098662552692596857/image.png▾
rp
04/20/2023, 5:35 PMSekai
04/20/2023, 5:35 PMrp
04/20/2023, 5:38 PMSekai
04/20/2023, 5:38 PMrp
04/20/2023, 5:39 PMSekai
04/20/2023, 5:40 PMhttps://cdn.discordapp.com/attachments/1098354365221314680/1098664395028058232/image.png▾
rp
04/20/2023, 5:41 PMawait session.fetchAndSetClaim(UserRoleClaim)
(see in here: https://supertokens.com/docs/userroles/managing-roles-and-users)Sekai
04/20/2023, 5:41 PMrp
04/20/2023, 5:42 PMawait UserRoles.addRoleRoUser(..)
.session
response.session
Sekai
04/20/2023, 5:43 PMWillB
04/21/2023, 9:03 PM