Stop any active app task on uninstall
This commit is contained in:
@@ -673,18 +673,23 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
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');
|
||||
}
|
||||
var NOOP = function (next) { return next(); };
|
||||
var stopAppTask = $scope.app.taskId ? Client.stopTask.bind(null, $scope.app.taskId) : NOOP;
|
||||
|
||||
$scope.uninstall.busy = false;
|
||||
stopAppTask(function () { // ignore error
|
||||
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;
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user