Add option to Identity#store to fail if it exists

This commit is contained in:
Esteban Ordano 2014-10-28 17:00:01 -03:00
commit 281d66d6e0
2 changed files with 20 additions and 14 deletions

View file

@ -29,7 +29,13 @@ angular.module('copayApp.services')
controllerUtils.onErrorDigest(
scope, 'Could not create default wallet');
} else {
controllerUtils.bindProfile(scope, iden, wallet.id);
iden.store({failIfExists: true}, function(err) {
if (err) {
controllerUtils.onErrorDigest(scope, 'User already exists!');
} else {
controllerUtils.bindProfile(scope, iden, wallet.id);
}
});
}
scope.loading = false;
});