Instead of .env.local, I had to add the supabase environment variables to next.config.js because the client supabase is declared client side instead of server side.
With nextauth I had to do an async call getSession() to request the userId first before querying because the userId isn't exposed to the default session object for security reasons
This was also my first time using Typescript so there were all kinds of issues trying to follow the code to get it working on my own project.
~ Fiending Entrepreneur.
~ CTO & Co-Founder of two mid-sized tech businesses.
~ Feel free to reach out to me for any collaborations, projects or discussions 😄.
Excellent work. 🌟
Only thing I would do differently is to create a resuable function for storing your form state.
You use the following pattern:
Which could be upgraded to:
Thank you for making this tutorial. This is almost exactly what I needed, but I used NextAuth.js to create the authentication table.
So did you connect nextauth with the supabase postgres instance
I did. Several things I had to do different.
Instead of
.env.local, I had to add the supabase environment variables tonext.config.jsbecause the client supabase is declared client side instead of server side.With nextauth I had to do an async call getSession() to request the userId first before querying because the userId isn't exposed to the default session object for security reasons
This was also my first time using Typescript so there were all kinds of issues trying to follow the code to get it working on my own project.
That's awesome.
Amazing!
Glad you liked it!
I am a simple man, I see React-Query, I press "LOVE"
Haha
This is excellent thank you
This pattern continues to replace 99% of my state boilerplate. Thanks again Ankit, really
Really useful article, Ankit! Keep up the good work
Thanks Aquib
Thank you for this <3