fix delete profile
This commit is contained in:
parent
b018028b17
commit
1a6f0aacf1
2 changed files with 20 additions and 8 deletions
|
|
@ -1,5 +1,5 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('ProfileController', function($scope, $rootScope, $location, $modal, $filter, $timeout, backupService, identityService, isMobile, isCordova) {
|
||||
angular.module('copayApp.controllers').controller('ProfileController', function($scope, $rootScope, $location, $modal, $filter, $timeout, backupService, identityService, isMobile, isCordova, notification) {
|
||||
$scope.username = $rootScope.iden.getName();
|
||||
$scope.isSafari = isMobile.Safari();
|
||||
$scope.isCordova = isCordova;
|
||||
|
|
@ -26,16 +26,20 @@ angular.module('copayApp.controllers').controller('ProfileController', function(
|
|||
};
|
||||
|
||||
$scope.deleteProfile = function() {
|
||||
$scope.loading = true;
|
||||
identityService.deleteProfile(function(err, res) {
|
||||
$scope.loading = false;
|
||||
if (err) {
|
||||
log.warn(err);
|
||||
notification.error('Error', 'Could not delete profile');
|
||||
return;
|
||||
$timeout(function () { $scope.$digest(); });
|
||||
}
|
||||
else {
|
||||
$location.path('/');
|
||||
$timeout(function() {
|
||||
notification.success('Success', 'Profile successfully deleted');
|
||||
});
|
||||
}
|
||||
$location.path('/');
|
||||
$timeout(function() {
|
||||
notification.error('Success', 'Profile successfully deleted');
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -76,10 +76,18 @@
|
|||
<h2>Are you sure you want to delete this profile?</h2>
|
||||
<div class="row">
|
||||
<div class="large-6 medium-6 small-6 columns">
|
||||
<a translate class="button gray m0" ng-click="confirmDelete=!confirmDelete">Cancel</a>
|
||||
<button class="gray" ng-disabled="loading"
|
||||
ng-click="confirmDelete=!confirmDelete">Cancel</button>
|
||||
</div>
|
||||
<div class="large-6 medium-6 small-6 columns">
|
||||
<a translate class="button warning m0" ng-click="deleteProfile()">Delete</a>
|
||||
<button class="warning" ng-disabled="loading" ng-click="deleteProfile()">
|
||||
<span ng-show="!loading">
|
||||
<i class="fi-trash"></i> Delete
|
||||
</span>
|
||||
<span ng-show="loading">
|
||||
<i class="fi-bitcoin-circle icon-rotate spinner"></i> Deleting...
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue