summary refs log tree commit diff
path: root/webclient/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'webclient/app.js')
-rw-r--r--webclient/app.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/webclient/app.js b/webclient/app.js
index f869309449..0b613fa206 100644
--- a/webclient/app.js
+++ b/webclient/app.js
@@ -42,20 +42,20 @@ matrixWebClient.config(['$routeProvider', '$provide', '$httpProvider',
                 redirectTo: '/rooms'
             });
             
-        $provide.factory('AccessTokenInterceptor', function ($q) {
+        $provide.factory('AccessTokenInterceptor', ['$q', '$rootScope', 
+            function ($q, $rootScope) {
             return {
                 responseError: function(rejection) {
-                    console.log("Rejection: " + JSON.stringify(rejection));
                     if (rejection.status === 403 && "data" in rejection && 
                             "errcode" in rejection.data && 
                             rejection.data.errcode === "M_UNKNOWN_TOKEN") {
-                        console.log("TODO: Got a 403 with an unknown token. Logging out.")
-                        // TODO logout
+                        console.log("Got a 403 with an unknown token. Logging out.")
+                        $rootScope.$broadcast("M_UNKNOWN_TOKEN");
                     }
                     return $q.reject(rejection);
                 }
             };
-        });
+        }]);
         $httpProvider.interceptors.push('AccessTokenInterceptor');
     }]);