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

@ -1,6 +1,6 @@
import ko from 'ko';
import { Scope, Notification } from 'Common/Enums';
import { Scope } from 'Common/Enums';
import { getNotification, i18n } from 'Common/Translator';
import { isNonEmptyArray } from 'Common/Utils';
@ -53,16 +53,11 @@ class PluginPopupView extends AbstractViewPopup {
Remote.pluginSettingsUpdate(this.onPluginSettingsUpdateResponse, list);
}
onPluginSettingsUpdateResponse(iError, data) {
if (!iError && data && data.Result) {
this.cancelCommand();
onPluginSettingsUpdateResponse(iError) {
if (iError) {
this.saveError(getNotification(iError));
} else {
this.saveError('');
if (data && data.ErrorCode) {
this.saveError(getNotification(data.ErrorCode));
} else {
this.saveError(getNotification(Notification.CantSavePluginSettings));
}
this.cancelCommand();
}
}