GGboi.eth
Pass authed user data to protected routes
I am trying to pass validated data to protected routes so I don't have to check undefined. Routes are currently protected with RouteGuard which redirects to the sign in page if there is no user.
If there is a user, I want to pass the validated data to all nested routes without having to manually pass the data to each route or setup a context provider for each route.
The example above shows the
/home
route receiving the user props throught the AuthWrapper component. But I would need to do that for every route.
Is there some equivalent to this?
Also, I plan on using solid-query as the async state manager so it would be great if the solution could just use the user response from RouteGuard. This would just be a bonus though2 replies