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:
Kenji Ishii 2016-03-18 14:37:13 +09:00
parent e27513d11c
commit 9399680106
2 changed files with 4 additions and 3 deletions

View File

@ -64,7 +64,8 @@
return {
responseError: function (error) {
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);
}

View File

@ -36,11 +36,11 @@
describe('when unauthorized', function() {
it('should redirect to /auth/logout', inject(function($http, $httpBackend, $window) {
$window.WEBROOT = '/dashboard/';
$httpBackend.when('GET', '/api').respond(401, '');
$http.get('/api').error(function() {
expect($window.location.replace).toHaveBeenCalledWith('/auth/logout');
expect($window.location.replace).toHaveBeenCalledWith('/dashboard/auth/logout');
});
$httpBackend.flush();
}));