(function () {
    'use strict';

    function todoHttpInterceptor($q, $injector) {
        return {
            requestError: function (rejection) {
                return $q.reject(rejection);
            },
            response: function (response) {
                return response;
            },
            responseError: function (rejection) {
                if ((rejection.config.url + "").indexOf('token') === -1) {
                    if (rejection.status === 401) {
                        $injector.get('$state').go('login', {error: 'The session has expired, please sign in again.'}, {reload: true});
                        $injector.get('AuthService').logout();
                    }
                }
                return $q.reject(rejection);
            }
        };
    }

    angular.module('mytodoApp.config.interceptors', [])
        .factory('todoHttpInterceptor', ['$q', '$injector', todoHttpInterceptor]);
})();

@@ -73,20 +73,34 @@
 injector
+, $cookieStore
 ) %7B%0A
-
         
@@ -482,24 +482,71 @@
  === 401) %7B%0A
+                        var errorMessage =%0A    
             
@@ -562,50 +562,69 @@
    $
-injec
+cookieS
 tor
+e
 .get('
-$state').go('login', %7Berror:
+username') ?%0A                               
  'Th
@@ -668,16 +668,137 @@
  again.'
+ :%0A                                null;%0A                        $injector.get('$state').go('login', %7Berror: errorMessage
 %7D, %7Brelo
@@ -1045,16 +1045,16 @@
 s', %5B%5D)%0A
-
         
@@ -1104,16 +1104,32 @@
 jector',
+ '$cookieStore',
  todoHtt

remove 'token expired' message for new user in login page