(js) Simplify Account.prototype.$newMailbox

pull/100/merge
Francis Lachapelle 2015-08-18 21:20:34 -04:00
parent 83fee27ca8
commit 1470258b5c
1 changed files with 2 additions and 9 deletions

View File

@ -186,18 +186,11 @@
* @returns a promise of the HTTP operations
*/
Account.prototype.$newMailbox = function(path, name) {
var _this = this,
deferred = Account.$q.defer();
var _this = this;
// Prefix '' to the path since we might get an integer here (account's id)
Account.$$resource.post('' + path, 'createFolder', {name: name}).then(function() {
return Account.$$resource.post(path.toString(), 'createFolder', {name: name}).then(function() {
_this.$getMailboxes({reload: true});
deferred.resolve();
}, function(response) {
deferred.reject(response.error);
});
return deferred.promise;
};
/**