Commit 1c2f4ead34eb9498e869384d1219a3b827b12b12
Exists in
master
Merge branch 'master' into 'master'
reemplazar cookies por localstorage See merge request modulos-npm/foca-configuracion!3
Showing
4 changed files
Show diff stats
package.json
src/js/app.js
1 | -angular.module('focaConfiguracion', []) | |
2 | - .run(['$cookies', 'focaConfiguracionService', function($cookies, focaConfiguracionService) { | |
3 | - if (!$cookies.get("terminalKey")) { | |
1 | +angular.module('focaConfiguracion', ['ngStorage']) | |
2 | + .run(['$localStorage', 'focaConfiguracionService', function($localStorage, focaConfiguracionService) { | |
3 | + if (!$localStorage.terminalKey) { | |
4 | 4 | focaConfiguracionService.getHashTerminal().then(function(res) { |
5 | - $cookies.put('terminalKey', res.data); | |
5 | + $localStorage.terminalKey = res.data; | |
6 | 6 | }); |
7 | 7 | } |
8 | 8 | }]); |
9 | 9 | \ No newline at end of file |
src/js/requestHeadersInterceptor.js
1 | 1 | angular.module('focaConfiguracion') |
2 | 2 | .factory("RequestHeadersInterceptor", [ |
3 | - '$cookies', function($cookies) { | |
3 | + '$localStorage', function($localStorage) { | |
4 | 4 | var request = { |
5 | 5 | request: function(config) { |
6 | - config.headers["X-Terminal-Key"] = $cookies.get("terminalKey"); | |
6 | + config.headers["X-Terminal-Key"] = $localStorage.terminalKey; | |
7 | 7 | return config; |
8 | 8 | } |
9 | 9 | } |
src/js/service.js
1 | 1 | angular.module('focaConfiguracion') |
2 | 2 | .factory("focaConfiguracionService", [ |
3 | - '$http', '$cookies', '$q', 'API_ENDPOINT', | |
4 | - function($http, $cookies, $q, API_ENDPOINT) { | |
3 | + '$http', 'API_ENDPOINT', | |
4 | + function($http, API_ENDPOINT) { | |
5 | 5 | return { |
6 | 6 | getHashTerminal: function() { |
7 | 7 | return $http.get(API_ENDPOINT.URL + '/config/terminal'); |