Tauffer-Consulting/domino

block app access on auth context

Closed this issue · 0 comments

Our AuthContext always returns the children component, so all functions within useEffect in these child components try to run, even if the token is missing or something else, this causes many errors before the user goes to login.

image

To fix this we can:

  • create a route to ensure that the token is valid (revalidate token route)
  • return a loading element if in the authentication context we have not yet checked the token status

This will correct errors and ensure that no unauthorized requests are sent to others

ex:

image