diff -r 903d6f504f71 -r ffdfe491869c client/app/app.js --- a/client/app/app.js Thu Jun 11 15:38:19 2015 +0200 +++ b/client/app/app.js Thu Jun 11 16:19:36 2015 +0200 @@ -3,10 +3,10 @@ angular.module('ammico', [ 'ngRoute','ammicoHome', 'ammicoMyvisit', 'ammicoBooks', 'ammicoVisites', 'ammicoSlides', 'ammicoSlideshow', 'ammicoSearch', 'ammicoAuth', 'ammicoCommon', 'templates' ]) .config(function($routeProvider, $httpProvider) { - $httpProvider.interceptors.push(function($q, $location) { + $httpProvider.interceptors.push(function($q) { return { responseError: function(rejection) { - if (rejection.status == 401) { + if (rejection.status === 401) { localStorage.removeItem('token'); } return $q.reject(rejection); @@ -76,15 +76,15 @@ }) .run( function($rootScope, $location, $window, $http, authApi, context) { $rootScope.globals = {}; - if (localStorage.getItem('token') || context['token']) { + if (localStorage.getItem('token') || context.token) { $rootScope.globals.userLogged = true; - localStorage.setItem('token', (localStorage.getItem('token') || context['token'])); - $http.defaults.headers.common.Authorization = 'Token ' + (localStorage.getItem('token') || context['token']); + localStorage.setItem('token', (localStorage.getItem('token') || context.token)); + $http.defaults.headers.common.Authorization = 'Token ' + (localStorage.getItem('token') || context.token); } $rootScope.$on( '$routeChangeStart', function(event, next) { if (next.authRequired && !$rootScope.globals.userLogged) { $location.path( '/auth/login' ); } }); - }) + }); })();