1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-02 08:30:14 +01:00

folder fixes

This commit is contained in:
Kyle Spearrin 2017-07-12 10:16:04 -04:00
parent 0574c538e7
commit 13fbfc43f9
2 changed files with 23 additions and 2 deletions

View File

@ -339,6 +339,25 @@ function initApiService() {
});
};
ApiService.prototype.deleteFolder = function (id, success, error) {
var self = this;
handleTokenState(self).then(function (token) {
$.ajax({
type: 'POST',
url: self.baseUrl + '/folders/' + id + '/delete?' + token,
dataType: 'text',
success: function (response) {
success();
},
error: function (jqXHR, textStatus, errorThrown) {
handleError(error, jqXHR, false, self);
}
});
}, function (jqXHR) {
handleError(error, jqXHR, true, self);
});
};
// Cipher APIs
ApiService.prototype.getCipher = function (id, success, error) {

View File

@ -18,7 +18,7 @@ function initFolderService() {
id: folder.id
};
return self.cryptoService.encrypt(folder.name).then(function (cs) {
return this.cryptoService.encrypt(folder.name).then(function (cs) {
model.name = cs;
return model;
});
@ -206,6 +206,8 @@ function initFolderService() {
var self = this;
// TODO: Delete folder reference for associated ciphers
self.userService.getUserId(function (userId) {
var foldersKey = 'folders_' + userId;
@ -244,7 +246,7 @@ function initFolderService() {
var deferred = Q.defer();
var self = this;
self.apiService.deleteCipher(id, function () {
self.apiService.deleteFolder(id, function () {
self.delete(id, function () {
deferred.resolve();
});