mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 11:39:21 +03:00
Change handling of (token) errors due to #1706
This commit is contained in:
parent
02ea6c4359
commit
d00c953c88
25 changed files with 80 additions and 69 deletions
|
|
@ -8,9 +8,9 @@ let iJsonErrorCount = 0;
|
|||
const getURL = (add = '') => serverRequest('Json') + pString(add),
|
||||
|
||||
checkResponseError = data => {
|
||||
const err = data ? data.ErrorCode : null;
|
||||
const err = data ? data.code : null;
|
||||
if (Notifications.InvalidToken === err) {
|
||||
console.error(getNotification(err) + ` (${data.ErrorMessageAdditional})`);
|
||||
console.error(getNotification(err) + ` (${data.messageAdditional})`);
|
||||
// alert(getNotification(err));
|
||||
setTimeout(rl.logoutReload, 5000);
|
||||
} else if ([
|
||||
|
|
@ -144,7 +144,7 @@ export class AbstractFetchRemote
|
|||
iJsonErrorCount = 0;
|
||||
} else {
|
||||
checkResponseError(data);
|
||||
iError = data.ErrorCode || Notifications.UnknownError
|
||||
iError = data.code || Notifications.UnknownError
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ export class AbstractFetchRemote
|
|||
return Promise.reject(new FetchError(Notifications.JsonParse));
|
||||
}
|
||||
|
||||
if (111 === data?.ErrorCode && rl.app.ask && await rl.app.ask.cryptkey()) {
|
||||
if (111 === data?.code && rl.app.ask && await rl.app.ask.cryptkey()) {
|
||||
return this.post(action, fTrigger, params, timeOut);
|
||||
}
|
||||
/*
|
||||
|
|
@ -222,8 +222,8 @@ export class AbstractFetchRemote
|
|||
if (!data.Result || action !== data.Action) {
|
||||
checkResponseError(data);
|
||||
return Promise.reject(new FetchError(
|
||||
data ? data.ErrorCode : 0,
|
||||
data ? (data.ErrorMessageAdditional || data.ErrorMessage) : ''
|
||||
data ? data.code : 0,
|
||||
data ? (data.messageAdditional || data.message) : ''
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue