mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-20 19:24:06 -04:00
Move the unknown token broadcast to the interceptor. Return the $http promise and not a wrapped one via $q. Everything now needs a level deeper nesting. Fixed registration and login.
This commit is contained in:
parent
76005c44f7
commit
db3e1d73c6
4 changed files with 16 additions and 30 deletions
|
@ -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');
|
||||
}]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue