When the user exits the application, Pinia's persistent authStore
state is reset and the user is redirected to /login. However, if the next user logs in without refreshing the page, the main page still displays the previous user's data because it is still in the page's state. How should I solve this problem?
How should I reset every state in the application on logout? Are there any recommended solutions for isolating the state of one authentication session from another?
I've tried manually resetting the page's state when the "logout" button is pressed on the page, in case it doesn't refresh later, but that only helps me with part of the problem: most of the time, the button and it's handler are located In a separate page within the layout or settings.
The solution I found was to trigger a full reload of the app after logout, calling
reloadNuxtApp
. This will solve the problem.