- sistemazioni Email : registrazione, invio invito, email di benvenuto
- fix circuito - profilo
This commit is contained in:
@@ -148,8 +148,8 @@ export const Api = {
|
||||
const userStore = useUserStore();
|
||||
|
||||
if (
|
||||
status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_TOKEN_EXPIRED ||
|
||||
statuscode2 === serv_constants.RIS_CODE__HTTP_FORBIDDEN_TOKEN_EXPIRED
|
||||
status === serv_constants.RIS_CODE__HTTP_TOKEN_EXPIRED ||
|
||||
statuscode2 === serv_constants.RIS_CODE__HTTP_TOKEN_EXPIRED
|
||||
) {
|
||||
try {
|
||||
console.log('Token scaduto. Tentativo di refresh...');
|
||||
@@ -173,7 +173,7 @@ export const Api = {
|
||||
let mystatus = err2?.code || err2?.status;
|
||||
|
||||
if (
|
||||
mystatus === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN ||
|
||||
mystatus === serv_constants.RIS_CODE__HTTP_INVALID_TOKEN ||
|
||||
mystatus === serv_constants.RIS_CODE__HTTP_FORBIDDEN_PERMESSI ||
|
||||
mystatus === toolsext.ERR_RETRY_LOGIN
|
||||
) {
|
||||
@@ -183,12 +183,12 @@ export const Api = {
|
||||
}
|
||||
|
||||
// Gestione di altri errori critici
|
||||
throw err2 || { status: serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN };
|
||||
throw err2 || { status: serv_constants.RIS_CODE__HTTP_INVALID_TOKEN };
|
||||
}
|
||||
} else if (
|
||||
// status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN ||
|
||||
// status === serv_constants.RIS_CODE__HTTP_INVALID_TOKEN ||
|
||||
status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_PERMESSI
|
||||
// || statuscode2 === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN
|
||||
// || statuscode2 === serv_constants.RIS_CODE__HTTP_INVALID_TOKEN
|
||||
) {
|
||||
userStore.setAuth('', '');
|
||||
throw { status: toolsext.ERR_RETRY_LOGIN };
|
||||
@@ -239,10 +239,11 @@ export const Api = {
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
if (res.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
|
||||
if (res.status === serv_constants.RIS_CODE__HTTP_INVALID_TOKEN) {
|
||||
userStore.setServerCode(toolsext.ERR_AUTHENTICATION);
|
||||
userStore.setAuth('', '');
|
||||
throw { code: toolsext.ERR_AUTHENTICATION };
|
||||
// throw { code: toolsext.ERR_AUTHENTICATION };
|
||||
throw { status: toolsext.ERR_RETRY_LOGIN };
|
||||
}
|
||||
|
||||
// Verifica sul token (funzione custom)
|
||||
@@ -269,6 +270,13 @@ export const Api = {
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
if (error.status === serv_constants.RIS_CODE__HTTP_INVALID_TOKEN) {
|
||||
userStore.setServerCode(toolsext.ERR_AUTHENTICATION);
|
||||
userStore.setAuth('', '');
|
||||
// throw { code: toolsext.ERR_AUTHENTICATION };
|
||||
throw { status: toolsext.ERR_RETRY_LOGIN };
|
||||
}
|
||||
|
||||
const ret: any = await this.checkTokenScaduto(
|
||||
error.status,
|
||||
evitaloop,
|
||||
@@ -341,9 +349,12 @@ export const Api = {
|
||||
options
|
||||
);
|
||||
} catch (error) {
|
||||
// Se lo status non è 403 e sono rimasti tentativi, eseguo il retry
|
||||
// Se lo status non è 403 (RIS_CODE__HTTP_FORBIDDEN_PERMESSI) e sono rimasti tentativi, eseguo il retry
|
||||
const riprova =
|
||||
error && error.status !== 403 && error.status !== toolsext.ERR_RETRY_LOGIN;
|
||||
error &&
|
||||
error.status !== serv_constants.RIS_CODE__HTTP_INVALID_TOKEN &&
|
||||
error.status !== serv_constants.RIS_CODE__HTTP_FORBIDDEN_PERMESSI &&
|
||||
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