Commit 62d9449970ceb2039e021ee66914c25d51ce01c4
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request !1
Showing
5 changed files
Show diff stats
package.json
| ... | ... | @@ -36,19 +36,25 @@ |
| 36 | 36 | "pump": "^3.0.0" |
| 37 | 37 | }, |
| 38 | 38 | "devDependencies": { |
| 39 | - "angular": "^1.7.5", | |
| 40 | - "angular-cookies": "^1.7.5", | |
| 41 | - "angular-route": "^1.7.5", | |
| 39 | + "angular": "^1.7.7", | |
| 40 | + "angular-cookies": "^1.7.7", | |
| 41 | + "angular-route": "^1.7.7", | |
| 42 | + "bootstrap": "^4.3.1", | |
| 43 | + "font-awesome": "^4.7.0", | |
| 42 | 44 | "gulp": "^3.9.1", |
| 43 | - "gulp-angular-templatecache": "^2.2.3", | |
| 45 | + "gulp-angular-templatecache": "^2.2.6", | |
| 44 | 46 | "gulp-clean": "^0.4.0", |
| 45 | 47 | "gulp-concat": "^2.6.1", |
| 48 | + "gulp-connect": "^5.7.0", | |
| 49 | + "gulp-htmlmin": "^5.0.1", | |
| 46 | 50 | "gulp-jshint": "^2.1.0", |
| 47 | 51 | "gulp-rename": "^1.4.0", |
| 48 | 52 | "gulp-replace": "^1.0.0", |
| 53 | + "gulp-sequence": "^1.0.0", | |
| 49 | 54 | "gulp-uglify": "^3.0.1", |
| 55 | + "jasmine-core": "^3.3.0", | |
| 50 | 56 | "jquery": "^3.3.1", |
| 51 | - "jshint": "^2.9.6", | |
| 57 | + "jshint": "^2.10.1", | |
| 52 | 58 | "ngstorage": "^0.3.11", |
| 53 | 59 | "pre-commit": "^1.2.2", |
| 54 | 60 | "pump": "^3.0.0" |
src/js/app.js
| 1 | 1 | angular.module('focaConfiguracion', ['ngStorage']) |
| 2 | - .run(['$localStorage', 'focaConfiguracionService', function($localStorage, focaConfiguracionService) { | |
| 2 | + .run([ | |
| 3 | + '$localStorage', | |
| 4 | + 'focaConfiguracionService', | |
| 5 | + '$cookies', | |
| 6 | + function($localStorage, focaConfiguracionService, $cookies) { | |
| 3 | 7 | if (!$localStorage.terminalKey) { |
| 4 | 8 | focaConfiguracionService.getHashTerminal().then(function(res) { |
| 9 | + | |
| 5 | 10 | $localStorage.terminalKey = res.data; |
| 11 | + | |
| 6 | 12 | }); |
| 7 | 13 | } |
| 8 | - }]); | |
| 9 | 14 | \ No newline at end of file |
| 15 | + | |
| 16 | + if (!$cookies.get('puntoVenta') && $localStorage.terminalKey) { | |
| 17 | + focaConfiguracionService.getPuntoVenta().then(function(res) { | |
| 18 | + | |
| 19 | + $cookies.put('puntoVenta', res.data); | |
| 20 | + }); | |
| 21 | + } | |
| 22 | + | |
| 23 | + }]); |
src/js/config.js
src/js/requestHeadersInterceptor.js
| 1 | 1 | angular.module('focaConfiguracion') |
| 2 | 2 | .factory("RequestHeadersInterceptor", [ |
| 3 | - '$localStorage', function($localStorage) { | |
| 3 | + '$localStorage', '$cookies', function($localStorage, $cookies) { | |
| 4 | 4 | var request = { |
| 5 | 5 | request: function(config) { |
| 6 | + | |
| 7 | + var nombreUsuario = $cookies.get('nombreUsuario'); | |
| 8 | + var puntoVenta = $cookies.get('puntoVenta'); | |
| 9 | + | |
| 6 | 10 | config.headers["X-Terminal-Key"] = $localStorage.terminalKey; |
| 11 | + config.headers["X-Nombre-Usuario"] = nombreUsuario; | |
| 12 | + config.headers["X-Punto-Venta"] = puntoVenta; | |
| 7 | 13 | return config; |
| 8 | 14 | } |
| 9 | 15 | } |
| 10 | - | |
| 16 | + | |
| 11 | 17 | return request; |
| 12 | 18 | } |
| 13 | - ]); | |
| 14 | 19 | \ No newline at end of file |
| 20 | + ]); |
src/js/service.js
| 1 | 1 | angular.module('focaConfiguracion') |
| 2 | 2 | .factory("focaConfiguracionService", [ |
| 3 | - '$http', 'API_ENDPOINT', | |
| 3 | + '$http', 'API_ENDPOINT', | |
| 4 | 4 | function($http, API_ENDPOINT) { |
| 5 | 5 | return { |
| 6 | 6 | getHashTerminal: function() { |
| 7 | - return $http.get(API_ENDPOINT.URL + '/config/terminal'); | |
| 7 | + return $http.get(API_ENDPOINT.ENDPOINT_BASE + '/terminal/obtener'); | |
| 8 | + }, | |
| 9 | + getPuntoVenta: function() { | |
| 10 | + return $http.get(API_ENDPOINT.URL + '/config/punto-venta'); | |
| 8 | 11 | } |
| 9 | 12 | } |
| 10 | 13 | } |
| 11 | - ]); | |
| 12 | 14 | \ No newline at end of file |
| 15 | + ]); |