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
Question about for loops
Why does the following code log numbers from 0 to 9 instead of 1 to 9?
i
is assigned as zero in the first expression, then it checks whether i
is less than 10
and moves to the next expression which is i++
, so it should increment the value of i
to 1
instead and log it
27 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