Files
meanTorrent/modules/users/client/config/users.client.config.js
Ryan Hutchison ef3a3f9548 formatting reboot (space-2 and consistency)
JSCS fixes

update editorconfig
2015-07-31 10:04:02 -04:00

31 lines
831 B
JavaScript

'use strict';
// Config HTTP Error Handling
angular.module('users').config(['$httpProvider',
function ($httpProvider) {
// Set the httpProvider "not authorized" interceptor
$httpProvider.interceptors.push(['$q', '$location', 'Authentication',
function ($q, $location, Authentication) {
return {
responseError: function (rejection) {
switch (rejection.status) {
case 401:
// Deauthenticate the global user
Authentication.user = null;
// Redirect to signin page
$location.path('signin');
break;
case 403:
// Add unauthorized behaviour
break;
}
return $q.reject(rejection);
}
};
}
]);
}
]);