mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Reset local creds if access is denied (#9114)
This commit is contained in:
@@ -144,6 +144,16 @@ export default {
|
||||
return response;
|
||||
}, (error) => {
|
||||
if (error.response.status >= 400) {
|
||||
// Check for conditions to reset the user auth
|
||||
const invalidUserMessage = [this.$t('invalidCredentials'), 'Missing authentication headers.'];
|
||||
if (invalidUserMessage.indexOf(error.response.data.message) !== -1) {
|
||||
localStorage.removeItem('habit-mobile-settings');
|
||||
localStorage.removeItem('hello');
|
||||
this.$store.state.isUserLoggedIn = false;
|
||||
window.location.href = '/static/home';
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
// Don't show errors from getting user details. These users have delete their account,
|
||||
// but their chat message still exists.
|
||||
let configExists = Boolean(error.response) && Boolean(error.response.config);
|
||||
|
||||
Reference in New Issue
Block a user