Commit 199bfcbb7ada575cb9933752edab6e7dc009299f

Authored by Nicolás Guarnieri
1 parent d21dc3a40f
Exists in master

reemplazar cookies por localstorage

... ... @@ -49,6 +49,7 @@
49 49 "gulp-uglify": "^3.0.1",
50 50 "jquery": "^3.3.1",
51 51 "jshint": "^2.9.6",
  52 + "ngstorage": "^0.3.11",
52 53 "pre-commit": "^1.2.2",
53 54 "pump": "^3.0.0"
54 55 }
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 }
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');