mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 13:09:21 +03:00
Set response ErrorCode as iError for easier fetch error handling
This commit is contained in:
parent
a46c0c3b21
commit
11fd6736bb
24 changed files with 145 additions and 253 deletions
|
|
@ -35,14 +35,11 @@ export class PackagesAdminSettings {
|
|||
|
||||
requestHelper(packageToRequest, install) {
|
||||
return (iError, data) => {
|
||||
if (iError || !data || !data.Result) {
|
||||
if (data && data.ErrorCode) {
|
||||
this.packagesError(getNotification(data.ErrorCode));
|
||||
} else {
|
||||
this.packagesError(
|
||||
getNotification(install ? Notification.CantInstallPackage : Notification.CantDeletePackage)
|
||||
);
|
||||
}
|
||||
if (iError) {
|
||||
this.packagesError(
|
||||
getNotification(install ? Notification.CantInstallPackage : Notification.CantDeletePackage)
|
||||
// ':\n' + getNotification(iError);
|
||||
);
|
||||
}
|
||||
|
||||
PackageAdminStore.forEach(item => {
|
||||
|
|
@ -52,7 +49,7 @@ export class PackagesAdminSettings {
|
|||
}
|
||||
});
|
||||
|
||||
if (!iError && data && data.Result && data.Result.Reload) {
|
||||
if (!iError && data.Result.Reload) {
|
||||
location.reload();
|
||||
} else {
|
||||
PackageAdminStore.fetch();
|
||||
|
|
|
|||
|
|
@ -60,13 +60,11 @@ export class PluginsAdminSettings {
|
|||
}
|
||||
|
||||
onPluginDisableRequest(iError, data) {
|
||||
if (!iError && data) {
|
||||
if (!data.Result && data.ErrorCode) {
|
||||
if (Notification.UnsupportedPluginPackage === data.ErrorCode && data.ErrorMessage && data.ErrorMessage) {
|
||||
PluginAdminStore.error(data.ErrorMessage);
|
||||
} else {
|
||||
PluginAdminStore.error(getNotification(data.ErrorCode));
|
||||
}
|
||||
if (iError) {
|
||||
if (Notification.UnsupportedPluginPackage === iError && data && data.ErrorMessage) {
|
||||
PluginAdminStore.error(data.ErrorMessage);
|
||||
} else {
|
||||
PluginAdminStore.error(getNotification(iError));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue