Fix the issue which redirect to Not Found page
If a session is timeout and then a user request ajax request, Horizon redirect to Not found page because the url is incorrect. This patch fix it in the correct url. Change-Id: I25b9e07b4f97594d05b0cdae931af9f142a18168 Closes-bug: #1558917
This commit is contained in:
parent
e27513d11c
commit
9399680106
|
@ -64,7 +64,8 @@
|
||||||
return {
|
return {
|
||||||
responseError: function (error) {
|
responseError: function (error) {
|
||||||
if (error.status === 401) {
|
if (error.status === 401) {
|
||||||
$windowProvider.$get().location.replace('/auth/logout');
|
var $window = $windowProvider.$get();
|
||||||
|
$window.location.replace($window.WEBROOT + 'auth/logout');
|
||||||
}
|
}
|
||||||
return $q.reject(error);
|
return $q.reject(error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,11 +36,11 @@
|
||||||
|
|
||||||
describe('when unauthorized', function() {
|
describe('when unauthorized', function() {
|
||||||
it('should redirect to /auth/logout', inject(function($http, $httpBackend, $window) {
|
it('should redirect to /auth/logout', inject(function($http, $httpBackend, $window) {
|
||||||
|
$window.WEBROOT = '/dashboard/';
|
||||||
$httpBackend.when('GET', '/api').respond(401, '');
|
$httpBackend.when('GET', '/api').respond(401, '');
|
||||||
|
|
||||||
$http.get('/api').error(function() {
|
$http.get('/api').error(function() {
|
||||||
expect($window.location.replace).toHaveBeenCalledWith('/auth/logout');
|
expect($window.location.replace).toHaveBeenCalledWith('/dashboard/auth/logout');
|
||||||
});
|
});
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in New Issue