sean
sean
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
P.S. There's nothing more annoying than a react hydration error, I absolutely hate those
43 replies
TTCTheo's Typesafe Cult
Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
Instead of doing how you did, did you think about doing something among the lines of:
return (
<YourLayout>
{asPath.startsWith("/dashboard") ? <Dashboard404/> : <Default404/> }
</YourLayout>
)
return (
<YourLayout>
{asPath.startsWith("/dashboard") ? <Dashboard404/> : <Default404/> }
</YourLayout>
)
43 replies
TTCTheo's Typesafe Cult
Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
No, it isn't bad xD
43 replies
TTCTheo's Typesafe Cult
Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
And you want to have different error pages, depending if you are on /dashboard or on the main route?
43 replies
TTCTheo's Typesafe Cult
Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
What does your folder structure look like?
43 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to automatically sign-in user in after they click a verify email link sent to their email inbox?
.
25 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to automatically sign-in user in after they click a verify email link sent to their email inbox?
Also, when the user first registers their account you can return a cookie anyways and then handle if they are verified or not. (a lot of websites tell you to verify with a popup or something like that)
25 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to automatically sign-in user in after they click a verify email link sent to their email inbox?
Yes
25 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to automatically sign-in user in after they click a verify email link sent to their email inbox?
Anyhow, I've never used next-auth, so they might have a different approach. Check out their docks
25 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to automatically sign-in user in after they click a verify email link sent to their email inbox?
In JWT you should only put information that you need to identify the user. DO NOT put their password into it. Just use an ID and the token expiration and creation date
25 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to automatically sign-in user in after they click a verify email link sent to their email inbox?
25 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to automatically sign-in user in after they click a verify email link sent to their email inbox?
Maybe with JWT?
25 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to automatically sign-in user in after they click a verify email link sent to their email inbox?
Anyhow, you can create a session token with the credentials
25 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to automatically sign-in user in after they click a verify email link sent to their email inbox?
Like never ever
25 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to automatically sign-in user in after they click a verify email link sent to their email inbox?
First of all, you should never store a user's password
25 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to automatically sign-in user in after they click a verify email link sent to their email inbox?
Oh gosh don't do that
25 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to automatically sign-in user in after they click a verify email link sent to their email inbox?
I would say there are a million ways to do this. You could do something like:
example.com/verify/SuperSecretAndUniqueCodeThatExpires
example.com/verify/SuperSecretAndUniqueCodeThatExpires
Then validate the super-secret token and return a cookie with the user session and finally redirect the user to the dashboard
25 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to display register/signin errors on the client from a server action?
I don't get how it does what it does
35 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to display register/signin errors on the client from a server action?
You have to, it feels like black magic
35 replies
TTCTheo's Typesafe Cult
Created by Ryan on 8/17/2023 in #questions
How to display register/signin errors on the client from a server action?
I usually just prefer to fetch data on the server to pre-render it, and then if I need to make other requests I just do them with API routes. I honestly though love Svelte's approach of fetching data, and I think that the React and Next team should take inspiration from them
35 replies