- fix: authenticate_withUser mancava su alcuni...
- fix: '/signin' non riproponeva il login nel caso il token fosse invalido
This commit is contained in:
@@ -139,7 +139,8 @@ export const Api = {
|
||||
} else {
|
||||
// Se il refresh token fallisce, logout dell'utente
|
||||
userStore.setAuth('', '');
|
||||
throw { code: toolsext.ERR_AUTHENTICATION };
|
||||
const $router = useRouter()
|
||||
throw { code: toolsext.ERR_RETRY_LOGIN };
|
||||
}
|
||||
} catch (err2) {
|
||||
console.error('Errore durante il refresh token:', err2);
|
||||
@@ -147,12 +148,16 @@ export const Api = {
|
||||
if (err2?.code === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
|
||||
userStore.setServerCode(toolsext.ERR_AUTHENTICATION);
|
||||
userStore.setAuth('', '');
|
||||
throw { code: toolsext.ERR_AUTHENTICATION };
|
||||
throw { status: toolsext.ERR_RETRY_LOGIN };
|
||||
}
|
||||
|
||||
// Gestione di altri errori critici
|
||||
throw err2;
|
||||
}
|
||||
} else if (status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
|
||||
userStore.setAuth('', '');
|
||||
const $router = useRouter()
|
||||
throw { status: toolsext.ERR_RETRY_LOGIN };
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -252,7 +257,7 @@ export const Api = {
|
||||
return await this.SendReqBase(url, method, mydata, setAuthToken, evitaloop, myformdata, responsedata, options);
|
||||
} catch (error) {
|
||||
// Se lo status non è 403 e sono rimasti tentativi, eseguo il retry
|
||||
const riprova = error.status !== 403;
|
||||
const riprova = error.status !== 403 && error.status !== toolsext.ERR_RETRY_LOGIN;
|
||||
if (retryCount > 0 && riprova) {
|
||||
console.log(`❌❌❌ Retrying request. Attempts remaining: ${retryCount}`);
|
||||
await this.delay(retryDelay);
|
||||
|
||||
Reference in New Issue
Block a user