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
1 | { | 1 | { |
2 | "name": "foca-configuracion", | 2 | "name": "foca-configuracion", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "", | 4 | "description": "", |
5 | "main": "index.js", | 5 | "main": "index.js", |
6 | "scripts": { | 6 | "scripts": { |
7 | "test": "echo \"Error: no test specified\" && exit 1", | 7 | "test": "echo \"Error: no test specified\" && exit 1", |
8 | "gulp-pre-commit": "gulp pre-commit", | 8 | "gulp-pre-commit": "gulp pre-commit", |
9 | "postinstall": "gulp uglify", | 9 | "postinstall": "gulp uglify", |
10 | "install-dev": "npm install -D gulp gulp-connect jasmine-core pre-commit angular angular-route angular-cookies bootstrap font-awesome gulp-angular-templatecache gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify gulp-replace jquery jshint pump" | 10 | "install-dev": "npm install -D gulp gulp-connect jasmine-core pre-commit angular angular-route angular-cookies bootstrap font-awesome gulp-angular-templatecache gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify gulp-replace jquery jshint pump" |
11 | }, | 11 | }, |
12 | "pre-commit": [ | 12 | "pre-commit": [ |
13 | "gulp-pre-commit" | 13 | "gulp-pre-commit" |
14 | ], | 14 | ], |
15 | "repository": { | 15 | "repository": { |
16 | "type": "git", | 16 | "type": "git", |
17 | "url": "https://debo.suite.repo/modulos-npm/foca-configuracion.git" | 17 | "url": "https://debo.suite.repo/modulos-npm/foca-configuracion.git" |
18 | }, | 18 | }, |
19 | "author": "Nicolás Guarnieri", | 19 | "author": "Nicolás Guarnieri", |
20 | "license": "ISC", | 20 | "license": "ISC", |
21 | "peerDependencies": { | 21 | "peerDependencies": { |
22 | "angular": "^1.7.5", | 22 | "angular": "^1.7.5", |
23 | "angular-cookies": "^1.7.5", | 23 | "angular-cookies": "^1.7.5", |
24 | "angular-route": "^1.7.5", | 24 | "angular-route": "^1.7.5", |
25 | "gulp": "^3.9.1", | 25 | "gulp": "^3.9.1", |
26 | "gulp-angular-templatecache": "^2.2.3", | 26 | "gulp-angular-templatecache": "^2.2.3", |
27 | "gulp-clean": "^0.4.0", | 27 | "gulp-clean": "^0.4.0", |
28 | "gulp-concat": "^2.6.1", | 28 | "gulp-concat": "^2.6.1", |
29 | "gulp-jshint": "^2.1.0", | 29 | "gulp-jshint": "^2.1.0", |
30 | "gulp-rename": "^1.4.0", | 30 | "gulp-rename": "^1.4.0", |
31 | "gulp-replace": "^1.0.0", | 31 | "gulp-replace": "^1.0.0", |
32 | "gulp-uglify": "^3.0.1", | 32 | "gulp-uglify": "^3.0.1", |
33 | "jquery": "^3.3.1", | 33 | "jquery": "^3.3.1", |
34 | "jshint": "^2.9.6", | 34 | "jshint": "^2.9.6", |
35 | "pre-commit": "^1.2.2", | 35 | "pre-commit": "^1.2.2", |
36 | "pump": "^3.0.0" | 36 | "pump": "^3.0.0" |
37 | }, | 37 | }, |
38 | "devDependencies": { | 38 | "devDependencies": { |
39 | "angular": "^1.7.5", | 39 | "angular": "^1.7.7", |
40 | "angular-cookies": "^1.7.5", | 40 | "angular-cookies": "^1.7.7", |
41 | "angular-route": "^1.7.5", | 41 | "angular-route": "^1.7.7", |
42 | "bootstrap": "^4.3.1", | ||
43 | "font-awesome": "^4.7.0", | ||
42 | "gulp": "^3.9.1", | 44 | "gulp": "^3.9.1", |
43 | "gulp-angular-templatecache": "^2.2.3", | 45 | "gulp-angular-templatecache": "^2.2.6", |
44 | "gulp-clean": "^0.4.0", | 46 | "gulp-clean": "^0.4.0", |
45 | "gulp-concat": "^2.6.1", | 47 | "gulp-concat": "^2.6.1", |
48 | "gulp-connect": "^5.7.0", | ||
49 | "gulp-htmlmin": "^5.0.1", | ||
46 | "gulp-jshint": "^2.1.0", | 50 | "gulp-jshint": "^2.1.0", |
47 | "gulp-rename": "^1.4.0", | 51 | "gulp-rename": "^1.4.0", |
48 | "gulp-replace": "^1.0.0", | 52 | "gulp-replace": "^1.0.0", |
53 | "gulp-sequence": "^1.0.0", | ||
49 | "gulp-uglify": "^3.0.1", | 54 | "gulp-uglify": "^3.0.1", |
55 | "jasmine-core": "^3.3.0", | ||
50 | "jquery": "^3.3.1", | 56 | "jquery": "^3.3.1", |
51 | "jshint": "^2.9.6", | 57 | "jshint": "^2.10.1", |
52 | "ngstorage": "^0.3.11", | 58 | "ngstorage": "^0.3.11", |
53 | "pre-commit": "^1.2.2", | 59 | "pre-commit": "^1.2.2", |
54 | "pump": "^3.0.0" | 60 | "pump": "^3.0.0" |
55 | } | 61 | } |
56 | } | 62 | } |
57 | 63 |
src/js/app.js
1 | angular.module('focaConfiguracion', ['ngStorage']) | 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 | if (!$localStorage.terminalKey) { | 7 | if (!$localStorage.terminalKey) { |
4 | focaConfiguracionService.getHashTerminal().then(function(res) { | 8 | focaConfiguracionService.getHashTerminal().then(function(res) { |
9 | |||
5 | $localStorage.terminalKey = res.data; | 10 | $localStorage.terminalKey = res.data; |
11 | |||
6 | }); | 12 | }); |
7 | } | 13 | } |
8 | }]); | ||
14 | |||
15 | if (!$cookies.get('puntoVenta') && $localStorage.terminalKey) { | ||
16 | focaConfiguracionService.getPuntoVenta().then(function(res) { | ||
17 | |||
18 | $cookies.put('puntoVenta', res.data); | ||
19 | }); | ||
20 | } | ||
21 | |||
22 | }]); |
src/js/config.js
1 | angular.module('focaConfiguracion') | 1 | angular.module('focaConfiguracion') |
2 | .config(['$httpProvider', function($httpProvider) { | 2 | .config(['$httpProvider', function($httpProvider) { |
3 | $httpProvider.interceptors.push('RequestHeadersInterceptor'); | 3 | $httpProvider.interceptors.push('RequestHeadersInterceptor'); |
4 | }]); | ||
4 | }]); |
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 | var puntoVenta = $cookies.get('puntoVenta'); | ||
9 | |||
6 | config.headers["X-Terminal-Key"] = $localStorage.terminalKey; | 10 | config.headers["X-Terminal-Key"] = $localStorage.terminalKey; |
11 | config.headers["X-Nombre-Usuario"] = nombreUsuario; | ||
12 | config.headers["X-Punto-Venta"] = puntoVenta; | ||
7 | return config; | 13 | return config; |
8 | } | 14 | } |
9 | } | 15 | } |
10 | 16 | ||
11 | return request; | 17 | return request; |
12 | } | 18 | } |
13 | ]); | ||
19 | ]); |
src/js/service.js
1 | angular.module('focaConfiguracion') | 1 | angular.module('focaConfiguracion') |
2 | .factory("focaConfiguracionService", [ | 2 | .factory("focaConfiguracionService", [ |
3 | '$http', 'API_ENDPOINT', | 3 | '$http', 'API_ENDPOINT', |
4 | function($http, API_ENDPOINT) { | 4 | function($http, API_ENDPOINT) { |
5 | return { | 5 | return { |
6 | getHashTerminal: function() { | 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 | ]); | ||
14 | ]); |