Show backend error if remote SSH cannot be enabled

This commit is contained in:
Johannes Zellner
2021-10-07 17:16:27 +02:00
parent 7f0035a823
commit 776c82ccae
2 changed files with 9 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ angular.module('Application').controller('SupportController', ['$scope', '$locat
altEmail: ''
};
$scope.toggleSshSupportError = '';
$scope.sshSupportEnabled = false;
$scope.subscription = null;
@@ -72,8 +73,14 @@ angular.module('Application').controller('SupportController', ['$scope', '$locat
};
$scope.toggleSshSupport = function () {
$scope.toggleSshSupportError = '';
Client.enableRemoteSupport(!$scope.sshSupportEnabled, function (error) {
if (error) return console.error(error);
if (error) {
if (error.statusCode === 412 || error.statusCode === 417) $scope.toggleSshSupportError = error.message;
else console.error(error);
return;
}
$scope.sshSupportEnabled = !$scope.sshSupportEnabled;
});