mirror of https://github.com/BTCPrivate/copay.git
remove profile
This commit is contained in:
parent
90136f1c30
commit
14cb044990
|
@ -55,6 +55,16 @@ angular.module('copayApp.controllers').controller('ProfileController', function(
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.deleteProfile = function () {
|
$scope.deleteProfile = function () {
|
||||||
|
identityService.deleteProfile(function (err, res) {
|
||||||
|
if (err) {
|
||||||
|
log.warn(err);
|
||||||
|
notification.error('Error', 'Could not delete profile');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$location.path('/');
|
||||||
|
setTimeout(function () {
|
||||||
|
notification.error('Success', 'Profile successfully deleted');
|
||||||
|
}, 1);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -307,6 +307,31 @@ Identity.prototype.store = function(opts, cb) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Object} opts
|
||||||
|
* @param {Function} cb
|
||||||
|
*/
|
||||||
|
Identity.prototype.remove = function(opts, cb) {
|
||||||
|
log.debug('Deleting profile');
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
opts = opts || {};
|
||||||
|
|
||||||
|
// HACK (isocolsky): remove notifications while deleting wallets
|
||||||
|
self.removeAllListeners('deletedWallet');
|
||||||
|
|
||||||
|
async.each(_.values(self.wallets), function(w, cb) {
|
||||||
|
self.deleteWallet(w.getId(), cb);
|
||||||
|
}, function (err) {
|
||||||
|
if (err) return cb(err);
|
||||||
|
self.storage.removeItem(self.getId(), function(err) {
|
||||||
|
if (err) return cb(err);
|
||||||
|
self.emitAndKeepAlive('closed');
|
||||||
|
return cb();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
Identity.prototype._cleanUp = function() {
|
Identity.prototype._cleanUp = function() {
|
||||||
// NOP
|
// NOP
|
||||||
};
|
};
|
||||||
|
|
|
@ -87,6 +87,10 @@ angular.module('copayApp.services')
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
root.deleteProfile = function (cb) {
|
||||||
|
$rootScope.iden.remove(null, cb);
|
||||||
|
};
|
||||||
|
|
||||||
root.deleteWallet = function(w, cb) {
|
root.deleteWallet = function(w, cb) {
|
||||||
$rootScope.iden.deleteWallet(w.id, cb);
|
$rootScope.iden.deleteWallet(w.id, cb);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue