1
0
mirror of https://github.com/bitwarden/web synced 2025-12-11 22:03:21 +00:00

reorganize project folder structure and remove asp.net dependency

This commit is contained in:
Kyle Spearrin
2016-11-30 23:50:00 -05:00
parent a5b8e703fc
commit b72a52232d
94 changed files with 76 additions and 330 deletions

29
src/app/apiInterceptor.js Normal file
View File

@@ -0,0 +1,29 @@
angular
.module('bit')
.factory('apiInterceptor', function ($injector, $q, toastr) {
return {
request: function (config) {
return config;
},
response: function (response) {
if (response.status === 401 || response.status === 403) {
$injector.get('authService').logOut();
$injector.get('$state').go('frontend.login.info').then(function () {
toastr.warning('Your login session has expired.', 'Logged out');
});
}
return response || $q.when(response);
},
responseError: function (rejection) {
if (rejection.status === 401 || rejection.status === 403) {
$injector.get('authService').logOut();
$injector.get('$state').go('frontend.login.info').then(function () {
toastr.warning('Your login session has expired.', 'Logged out');
});
}
return $q.reject(rejection);
}
};
});