Redirect to home with error message when status is 401

This commit is contained in:
AhyoungRyu 2016-07-09 23:58:01 +09:00
parent 2a054d4b55
commit 5c9242c3ed
2 changed files with 21 additions and 1 deletions

View file

@ -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._ = _;
@ -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);
});
};

View file

@ -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);
});
};