Question about redirect after user signing in. fro...
# general
f
Question about redirect after user signing in. frontendConfig(): code checks for "context.isNewUser" returns user to "select a subscription plan". Otherwise user will be redirected to a "member dashboard". At this stage, I would like to get the users "supertokens id", I'm stuck here. Is it somwhere in "context" at sign in?
r
hey @funk101 there is a getUserId function in the frontend SDK
f
hmm
r
Session.getUserId
f
during this?
Copy code
recipeList: [
      EmailPasswordReact.init({
        getRedirectionURL: async (context) => {
          console.log("Member: ", member);
          if (context.action === "SUCCESS") {
            if (context.redirectToPath !== undefined) {
              // navigate back to where the user was before authenticated
              return context.redirectToPath;
            }
            if (context.isNewUser) {
              return "/plans";
            } else if (member.user_type === "Administrator") {
              return "/admin-dashboard";
            } else {
              return "/member-dashboard";
            }
          }

          return undefined;
        },
(excuse the left over code from experimenting
)
r
yea
you can call that function in here for sure - if
context.action === "SUCCESS"
is true
f
ah sweet! thanks
2 Views