How can I stop code from executing before?
I am using
The
The
However, the
@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.