chen-rn / CUA

(deprecateed) create-universal-app(CUA) is an opinionated template for creating fullstack universal apps (Expo, Next, tRPC, Prisma, Clerk, Solito, Tamagui)
https://cua-demo.vercel.app
MIT License
1.01k stars 67 forks source link

Store user profile on the database at sign up time #5

Closed RicardoPBarbosa closed 1 year ago

RicardoPBarbosa commented 1 year ago

Is it possible to call trpc on app/utils folder to create a db entry for a user signing up? If not, how should I approach that?

P.S: @chen-rn Thank you for your work on this. It's really awesome!

chen-rn commented 1 year ago

For sure! I'll try to add this in soon! It is a missing piece for sure For now, if you'd like, you can call the create mutation in the user router with the email/name and whatever other information you want to store!

chen-rn commented 1 year ago

I've added this in the newest commit! Should work now :)

yassinebridi commented 1 year ago

Great stuff, the only thing that doesn't work is the user creation on social auth on web. It's like it doesn't communicate well here: handleOAuthSignUpWithPress(app/features/signup/screen.tsx:18)

chen-rn commented 1 year ago

Ahh good catch, yea it seems my approach is a little off since the user will be redirected to the OAuth site.

Seems like a better way to do oauth is something like this. Lemme fix that.

chen-rn commented 1 year ago

Apologies for the delay, I made an update and tested on both expo and web so it should be working now! The code might seem a little chunky but sharing auth/navigation code across mobile/web made this a little bit more complex.

I'll close this for now, if something else pops up I'll reopen it!

yassinebridi commented 1 year ago

Thank you Chen, really appreciate it 🙏