
(function () {
  'use strict';

  angular.module('Monitour.theme')
      .service('authInterceptor', authInterceptor);

  /** @ngInject */
  function authInterceptor($rootScope, $q, $localStorage) {
return {
    request: function (config) {
      config.headers = config.headers || {};
         if ($localStorage.currentUser) {
			console.log($localStorage.currentUser);
        config.headers.Authorization = 'Authorization ' + $localStorage.currentUser;
      }
      return config;
    },
    responseError: function (rejection) {
      if (rejection.status === 401) {
        // handle the case where the user is not authenticated
      }
      return $q.reject(rejection);
    }
  };
   
  }
})();
