Set response ErrorCode as iError for easier fetch error handling

This commit is contained in:
djmaze 2021-03-18 12:33:13 +01:00
parent a46c0c3b21
commit 11fd6736bb
24 changed files with 145 additions and 253 deletions

View file

@ -32,11 +32,9 @@ checkResponseError = data => {
) {
++iJsonErrorCount;
}
if (window.rl && (data.ClearAuth || data.Logout || 7 < iJsonErrorCount)) {
if (data.ClearAuth || data.Logout || 7 < iJsonErrorCount) {
rl.hash.clear();
if (!data.ClearAuth) {
rl.logoutReload();
}
data.ClearAuth || rl.logoutReload();
}
}
},
@ -116,10 +114,16 @@ export class AbstractFetchRemote
}
if (!iError && data) {
/*
if (sAction !== data.Action) {
console.log(sAction + ' !== ' + data.Action);
}
*/
if (data.Result) {
iJsonErrorCount = iTokenErrorCount = 0;
} else {
checkResponseError(data);
iError = data.ErrorCode || Notification.UnknownError
}
}