Move uninstall confirm dialog to app page

This commit is contained in:
Johannes Zellner
2019-09-13 11:18:43 +02:00
parent c4dfe8a723
commit 62fb0acb3c
4 changed files with 49 additions and 58 deletions

View File

@@ -411,6 +411,33 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
}
};
$scope.uninstall = {
busy: false,
error: {},
show: function () {
$('#uninstallModal').modal('show');
},
submit: function () {
$scope.uninstall.busy = true;
Client.uninstallApp($scope.app.id, function (error) {
if (error && error.statusCode === 402) { // unpurchase failed
Client.error('Relogin to Cloudron App Store');
} else if (error) {
Client.error(error);
} else {
$('#uninstallModal').modal('hide');
Client.refreshAppCache($scope.app.id); // reflect the new app state immediately
$location.path('/apps');
}
$scope.uninstall.busy = false;
});
}
};
function fetchUsers(callback) {
Client.getUsers(function (error, users) {
if (error) return callback(error);