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,5 @@
import { Notification } from 'Common/Enums';
import { pInt, pString } from 'Common/Utils';
import { i18n } from 'Common/Translator';
import { i18n, getNotification } from 'Common/Translator';
import Remote from 'Remote/Admin/Fetch';
@ -248,17 +247,13 @@ class DomainPopupView extends AbstractViewPopup {
}
}
onDomainCreateOrSaveResponse(iError, oData) {
onDomainCreateOrSaveResponse(iError) {
this.saving(false);
if (!iError && oData) {
if (oData.Result) {
DomainAdminStore.fetch();
this.closeCommand();
} else if (Notification.DomainAlreadyExists === oData.ErrorCode) {
this.savingError(i18n('ERRORS/DOMAIN_ALREADY_EXISTS'));
}
if (iError) {
this.savingError(getNotification(iError));
} else {
this.savingError(i18n('ERRORS/UNKNOWN_ERROR'));
DomainAdminStore.fetch();
this.closeCommand();
}
}