- fix: refresh token, codice di errore ...

This commit is contained in:
Surya Paolo
2025-03-15 14:52:25 +01:00
parent dfce2bc5eb
commit 201b739c8c
59 changed files with 726 additions and 87 deletions

View File

@@ -114,9 +114,9 @@ export const Api = {
} catch (error) {
console.error('Errore durante il refresh token:', error);
// Logout dell'utente in caso di errore critico
userStore.setAuth('', '');
localStorage.removeItem(toolsext.localStorage.token);
localStorage.removeItem(toolsext.localStorage.refreshToken);
// userStore.setAuth('', '');
// localStorage.removeItem(toolsext.localStorage.token);
// localStorage.removeItem(toolsext.localStorage.refreshToken);
throw error;
}
},
@@ -147,15 +147,15 @@ export const Api = {
if (err2?.code === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
userStore.setServerCode(toolsext.ERR_AUTHENTICATION);
// userStore.setAuth('', '');
throw { status: toolsext.ERR_RETRY_LOGIN };
userStore.setAuth('', '');
throw { status: err2.code };
}
// Gestione di altri errori critici
throw err2;
}
} else if (status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
// userStore.setAuth('', '');
userStore.setAuth('', '');
const $router = useRouter()
throw { status: toolsext.ERR_RETRY_LOGIN };
}