Reset errors after promises are resolved

pull/3753/head
Alex Dik 9 years ago
parent 8be10d1e80
commit a7a0e2768a
  1. 2
      frontend/app/components/inplace-edit/services/inplace-edit-multi-storage.service.js
  2. 10
      frontend/app/components/inplace-edit/services/inplace-edit-storage.service.js

@ -48,13 +48,13 @@ function inplaceEditMultiStorage($rootScope, $q, inplaceEditStorage, EditableFie
});
return $q.all(promises).then(function () {
EditableFieldsState.errors = null;
EditableFieldsState.currentField = null;
$rootScope.$broadcast('workPackageRefreshRequired');
}).finally(function () {
promises = [];
EditableFieldsState.errors = null;
EditableFieldsState.isBusy = false;
});
},

@ -35,11 +35,7 @@ function inplaceEditStorage($q, $rootScope, EditableFieldsState, WorkPackageServ
return {
saveWorkPackage: function () {
var deferred = $q.defer(),
handleErrors = function (errors) {
deferred.reject(errors);
EditableFieldsState.errors = null
};
var deferred = $q.defer();
if (EditableFieldsState.errors) {
deferred.reject(EditableFieldsState.errors);
@ -60,9 +56,9 @@ function inplaceEditStorage($q, $rootScope, EditableFieldsState, WorkPackageServ
deferred.resolve(updatedWorkPackage);
})
.catch(handleErrors);
.catch(deferred.reject);
})
.catch(handleErrors);
.catch(deferred.reject);
return deferred.promise;
},

Loading…
Cancel
Save