Commit bef6f00e59099e352b7ca260b7c2ed5c3982d23e

Authored by Eric Fernandez
1 parent 195b1d0198
Exists in master

refactor

src/js/requestHeadersInterceptor.js
1 angular.module('focaConfiguracion') 1 angular.module('focaConfiguracion')
2 .factory("RequestHeadersInterceptor", [ 2 .factory("RequestHeadersInterceptor", [
3 '$localStorage', function($localStorage) { 3 '$localStorage', '$cookies', function($localStorage, $cookies) {
4 var request = { 4 var request = {
5 request: function(config) { 5 request: function(config) {
6
7 var nombreUsuario = $cookies.get('nombreUsuario');
8
6 config.headers["X-Terminal-Key"] = $localStorage.terminalKey; 9 config.headers["X-Terminal-Key"] = $localStorage.terminalKey;
10 config.headers["Nombre-Usuario"] = nombreUsuario;
7 return config; 11 return config;
8 } 12 }
9 } 13 }
10 14
11 return request; 15 return request;
12 } 16 }
13 ]); 17 ]);
1 angular.module('focaConfiguracion') 1 angular.module('focaConfiguracion')
2 .factory("focaConfiguracionService", [ 2 .factory("focaConfiguracionService", [
3 '$http', 'ENDPOINT_BASE', 3 '$http', 'API_ENDPOINT',
4 function($http, ENDPOINT_BASE) { 4 function($http, API_ENDPOINT) {
5 return { 5 return {
6 getHashTerminal: function() { 6 getHashTerminal: function() {
7 return $http.get(ENDPOINT_BASE + '/terminal/obtener'); 7 return $http.get(API_ENDPOINT.ENDPOINT_BASE + '/terminal/obtener');
8 } 8 }
9 } 9 }
10 } 10 }
11 ]); 11 ]);
12 12