Skip to content

Commit

Permalink
Redirect to home with error message when status is 401
Browse files Browse the repository at this point in the history
  • Loading branch information
AhyoungRyu committed Jul 9, 2016
1 parent ab07564 commit b215364
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 11 additions & 1 deletion zeppelin-web/src/app/configuration/configuration.controller.js
Expand Up @@ -14,7 +14,7 @@
'use strict';

angular.module('zeppelinWebApp').controller('ConfigurationCtrl', function($scope, $route, $routeParams, $location,
$rootScope, $http, baseUrlSrv) {
$rootScope, $http, baseUrlSrv, ngToast) {
$scope.configrations = [];
$scope._ = _;

Expand All @@ -24,6 +24,16 @@ angular.module('zeppelinWebApp').controller('ConfigurationCtrl', function($scope
$scope.configurations = data.body;
}).
error(function(data, status, headers, config) {
if (status === 401) {
ngToast.danger({
content: 'You don\'t have permission on this page',
verticalPosition: 'bottom',
timeout: '3000'
});
setTimeout(function() {
window.location.replace('/');
}, 3000);
}
console.log('Error %o %o', status, data.message);
});
};
Expand Down
10 changes: 10 additions & 0 deletions zeppelin-web/src/app/interpreter/interpreter.controller.js
Expand Up @@ -27,6 +27,16 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl',
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter/setting').success(function(data, status, headers, config) {
$scope.interpreterSettings = data.body;
}).error(function(data, status, headers, config) {
if (status === 401) {
ngToast.danger({
content: 'You don\'t have permission on this page',
verticalPosition: 'bottom',
timeout: '3000'
});
setTimeout(function() {
window.location.replace('/');
}, 3000);
}
console.log('Error %o %o', status, data.message);
});
};
Expand Down

0 comments on commit b215364

Please sign in to comment.