open-saas
open-saas copied to clipboard
refactor our `userSignupFields` to use the new AuthUser identity properties in v014
currently we assign email and username to the User entity via our userSignupFields.ts custom signup functions. But now, in v0.14, we can instead directly access these properties on the auth user, e.g.
import { AuthUser } from 'wasp/auth'
const MainPage = ({ user }: { user: AuthUser }) => {
const email = user.identities.email?.id
// ...
}
There is however a pro to assigning email and username directly to User entity: it is somewhat easier to access later, we can access it even if user.identities haven't been populated, and also we don't have to constantly deal with specific of each provider/identity when trying to get an email / username.
I am not saying we shouldn't do the change you proposed here, but I am saying I am not sure if we should do it.
It's a bit complicated topic and we are still figuring out the best practices about it, here is the issue for figuring out and documenting them: https://github.com/wasp-lang/wasp/issues/2034 .
@infomiho FYI.
ok this is a good point, Martin. Closing this for now.