Skip to content

Commit 5c9242c

Browse files
committed
Redirect to home with error message when status is 401
1 parent 2a054d4 commit 5c9242c

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

zeppelin-web/src/app/configuration/configuration.controller.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
'use strict';
1515

1616
angular.module('zeppelinWebApp').controller('ConfigurationCtrl', function($scope, $route, $routeParams, $location,
17-
$rootScope, $http, baseUrlSrv) {
17+
$rootScope, $http, baseUrlSrv, ngToast) {
1818
$scope.configrations = [];
1919
$scope._ = _;
2020

@@ -24,6 +24,16 @@ angular.module('zeppelinWebApp').controller('ConfigurationCtrl', function($scope
2424
$scope.configurations = data.body;
2525
}).
2626
error(function(data, status, headers, config) {
27+
if (status === 401) {
28+
ngToast.danger({
29+
content: 'You don\'t have permission on this page',
30+
verticalPosition: 'bottom',
31+
timeout: '3000'
32+
});
33+
setTimeout(function() {
34+
window.location.replace('/');
35+
}, 3000);
36+
}
2737
console.log('Error %o %o', status, data.message);
2838
});
2939
};

zeppelin-web/src/app/interpreter/interpreter.controller.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl',
2727
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter/setting').success(function(data, status, headers, config) {
2828
$scope.interpreterSettings = data.body;
2929
}).error(function(data, status, headers, config) {
30+
if (status === 401) {
31+
ngToast.danger({
32+
content: 'You don\'t have permission on this page',
33+
verticalPosition: 'bottom',
34+
timeout: '3000'
35+
});
36+
setTimeout(function() {
37+
window.location.replace('/');
38+
}, 3000);
39+
}
3040
console.log('Error %o %o', status, data.message);
3141
});
3242
};

0 commit comments

Comments
 (0)