User is not redirected to a login screen if they were logged in and they were deleted in the meantime
We need a better way (UX wise) to handle the cases when a user is deleted, since deleting users is a feature of user management, and it's something that admins might do.
Expected behaviour
If a user is logged in, and they get deleted by admins, when they hit refresh on a protected page they should be redirected to the login page
Current behaviour
In the above situation, user is presented with a blank screen
Steps to reproduce
- Log in as a normal user
- navigate to a protected page (i.e. /dashboard)
- Log in on a different browser with an admin
- Navigate to users page and delete the aforementioned user
- Back to the user, when they hit refresh, they will get a blank screen
Possible solution
Redirect the user to the login page if the current user query returns an error (which happens if user does not exist in the db)