I created a thing, best way to access it in the same session?

I have a one-page sign-up form with many steps.

At the end of Step 1 , ‘user’ and ‘person’ things are created.

There is no page reload for Step 2, simply a hiding and showing of containers, although I do run a ‘reset inputs’ (not actually sure if it’s necessary, just thought I should…?) The user is not logged in or anything yet.

Steps 2 & 3 have the individual select a group to join and enter profile information. At the end of this, I want to access the ‘person’ that was created at the end of Step 1 to store in the ‘profile’ thing (‘profile’ has a person (Person) data type)

After Step 1 when I create the user and person things, should I be storing the ‘person’ in a custom state? Should I be putting the person ID as a URL param.

Any thoughts on the most efficient way to go about doing this?

Thanks :slight_smile:

How are you creating the user if they are not logged in? ‘create user for someone else’ ?

Why not log them in at this stage?

It’s a sign-up form, so they’re not logged in when they are using it (as they don’t have an account).

I’m using ‘Sign the user up’

As for why I don’t log them in, at the end of the flow (all 3 steps) there’s instruction for them to check and verify their email, which would log them in. I suppose I could just log them in and get them to verify in their own time…

If I don’t though, are states the way to go? Or URL params

e.g.

They are logged in…

But yeah, you can store them in custom state, or in a group… or in the data base (i.e. store the Person on the current user and/or vice-versa)

1 Like

Yes, they are logged in :slight_smile:

You may as well store it on the User.

How are they logged in? Does the Sign the user up automatically log the user in if successful?

Yes, the sign up action creates a new User and logs them in.

So, the most logical thing to do is store the Person on the User (and also reference the User on the person)

2 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.