tellform/public/modules/users/config/users.client.config.js

30 lines
671 B
JavaScript
Raw Normal View History

2015-06-30 16:15:16 +00:00
'use strict';
2015-06-29 22:51:29 +00:00
2015-06-30 11:05:44 +00:00
// Config HTTP Error Handling
2015-06-30 14:21:53 +00:00
angular.module('users').config(['$httpProvider',
function($httpProvider) {
2015-06-30 11:05:44 +00:00
// Set the httpProvider "not authorized" interceptor
$httpProvider.interceptors.push(['$q', '$location', 'Principal',
function($q, $location, Principal) {
return {
responseError: function(rejection) {
switch (rejection.status) {
case 401:
// Deauthenticate the global user
2015-06-29 22:51:29 +00:00
2015-06-30 11:05:44 +00:00
// Redirect to signin page
$location.path('signin');
break;
case 403:
// Add unauthorized behaviour
break;
}
2015-06-29 22:51:29 +00:00
2015-06-30 11:05:44 +00:00
return $q.reject(rejection);
}
};
}
]);
}
2015-06-30 16:15:16 +00:00
]);