i am new in angular when reading this article https://www.c-sharpcorner.com/UploadFile/ff2f08/token-based-authentication-using-Asp-Net-web-api-in-angularj/
i found few line of code which is not clear to me. those lines are
- .config(['$httpProvider', function ($httpProvider) {
-
- $httpProvider.interceptors.push(function ($q, $rootScope, $window, $location) {
-
- return {
- request: function (config) {
-
- return config;
- },
- requestError: function (rejection) {
-
- return $q.reject(rejection);
- },
- response: function (response) {
- if (response.status == "401") {
- $location.path('/login');
- }
-
- return response;
- },
- responseError: function (rejection) {
-
- if (rejection.status == "401") {
- $location.path('/login');
- }
- return $q.reject(rejection);
- }
- };
- });
please some one help me to understand the above few lines of code and their objective.