pronoob
Explore posts from serversHow do I implement authentication?
Hey there! I want to implement a very authentication, how would I go about implementing it? The user visits
/register
to create a new account. After they have created a new account, they must authentication by successfully logging in usingthe /login
, at this point, they should be able to see the content of the /proc
route18 replies
How can I stop code from executing before?
I am using
@solidjs/router
for routing, here's the code:
The Guard
component checks for authentication (whether key
is not in localStorage
) in createEffect
and navigates based on the result. The Root
component is a protected component and only authenticated user can access it (localStorage
contains the key
item).
The Root
component looks something like this:
However, the WebSocket
is connected before the Guard
component validates and navigates the user.5 replies