1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-26 17:08:33 +01:00

react to cipher import api change

This commit is contained in:
Kyle Spearrin 2016-06-07 20:05:49 -04:00
parent 35bdc82243
commit 4cf404d9c3
3 changed files with 13 additions and 6 deletions

View File

@ -21,6 +21,13 @@
del: { method: 'DELETE', params: { id: '@id' } } del: { method: 'DELETE', params: { id: '@id' } }
}); });
_service.ciphers = $resource(_apiUri + '/ciphers/:id', {}, {
get: { method: 'GET', params: { id: '@id' } },
list: { method: 'GET', params: {} },
'import': { url: _apiUri + '/ciphers/import', method: 'POST', params: {} },
del: { method: 'DELETE', params: { id: '@id' } }
});
_service.accounts = $resource(_apiUri + '/accounts', {}, { _service.accounts = $resource(_apiUri + '/accounts', {}, {
register: { url: _apiUri + '/accounts/register', method: 'POST', params: {} }, register: { url: _apiUri + '/accounts/register', method: 'POST', params: {} },
emailToken: { url: _apiUri + '/accounts/email-token', method: 'POST', params: {} }, emailToken: { url: _apiUri + '/accounts/email-token', method: 'POST', params: {} },

View File

@ -24,7 +24,7 @@
complete: function (results) { complete: function (results) {
var folders = [], var folders = [],
sites = [], sites = [],
siteRelationships = []; folderRelationships = [];
angular.forEach(results.data, function (value, key) { angular.forEach(results.data, function (value, key) {
if (!value.uri || value.uri === '') { if (!value.uri || value.uri === '') {
@ -65,11 +65,11 @@
key: siteIndex, key: siteIndex,
value: folderIndex value: folderIndex
}; };
siteRelationships.push(relationship); folderRelationships.push(relationship);
} }
}); });
success(folders, sites, siteRelationships); success(folders, sites, folderRelationships);
} }
}); });
} }

View File

@ -10,11 +10,11 @@
importService.import(model.source, file, importSuccess, importError); importService.import(model.source, file, importSuccess, importError);
}; };
function importSuccess(folders, sites, siteRelationships) { function importSuccess(folders, sites, folderRelationships) {
apiService.accounts.import({ apiService.ciphers.import({
folders: cipherService.encryptFolders(folders, cryptoService.getKey()), folders: cipherService.encryptFolders(folders, cryptoService.getKey()),
sites: cipherService.encryptSites(sites, cryptoService.getKey()), sites: cipherService.encryptSites(sites, cryptoService.getKey()),
siteRelationships: siteRelationships folderRelationships: folderRelationships
}, function () { }, function () {
$uibModalInstance.dismiss('cancel'); $uibModalInstance.dismiss('cancel');
$state.go('backend.vault').then(function () { $state.go('backend.vault').then(function () {