diff --git a/webadmin/src/js/client.js b/webadmin/src/js/client.js index 3fa77e650..2e17280f0 100644 --- a/webadmin/src/js/client.js +++ b/webadmin/src/js/client.js @@ -542,6 +542,13 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification', }).error(defaultErrorHandler(callback)); }; + Client.prototype.delOAuthClient = function (id, callback) { + $http.delete(client.apiOrigin + '/api/v1/oauth/clients/' + id).success(function(data, status) { + if (status !== 204) return callback(new ClientError(status, data)); + callback(null); + }).error(defaultErrorHandler(callback)); + }; + Client.prototype.getTokensByClientId = function (id, callback) { $http.get(client.apiOrigin + '/api/v1/oauth/clients/' + id + '/tokens').success(function(data, status) { if (status !== 200) return callback(new ClientError(status, data)); diff --git a/webadmin/src/views/account.html b/webadmin/src/views/account.html index 76919961c..bfb72b2c8 100644 --- a/webadmin/src/views/account.html +++ b/webadmin/src/views/account.html @@ -150,11 +150,14 @@ diff --git a/webadmin/src/views/account.js b/webadmin/src/views/account.js index bd075a707..5cdc98993 100644 --- a/webadmin/src/views/account.js +++ b/webadmin/src/views/account.js @@ -210,7 +210,7 @@ angular.module('Application').controller('AccountController', ['$scope', '$locat client: {}, show: function (client) { - $scope.clientRemove.busy = true; + $scope.clientRemove.busy = false; $scope.clientRemove.client = client; $('#clientRemoveModal').modal('show'); }, @@ -218,9 +218,16 @@ angular.module('Application').controller('AccountController', ['$scope', '$locat submit: function () { $scope.clientRemove.busy = true; - $scope.clientRemove.busy = false; + Client.delOAuthClient($scope.clientRemove.client.id, function (error) { + if (error) console.error(error); - $('#clientRemoveModal').modal('hide'); + $scope.clientRemove.busy = false; + $scope.clientRemove.client = {}; + + refresh(); + + $('#clientRemoveModal').modal('hide'); + }); } };