service.js
1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
angular.module('focaLogin')
.factory('focaLoginService', [
'$http', 'API_ENDPOINT', 'APP', '$cookies',
function ($http, API_ENDPOINT, APP, $cookies) {
return {
login: function (usuario) {
var param = APP ? '/' + APP : '';
return $http.post(API_ENDPOINT.URL + '/usuario/login' + param, usuario);
},
getLoginData: function () {
if ($cookies.get('chofer')) {
return { chofer: $cookies.get('chofer') };
}
if ($cookies.get('vendedorCobrador')) {
return { vendedorCobrador: $cookies.get('vendedorCobrador') };
}
if ($cookies.get('vendedorPlaya')) {
return { vendedorPlaya: $cookies.get('vendedorPlaya') };
}
},
getAllPuntoVenta: function () {
return $http.get(API_ENDPOINT.URL_AUTOSERVICIO + '/get/puntos-venta');
},
getAllImpresoras: function () {
return $http.get(API_ENDPOINT.URL_AUTOSERVICIO + '/get/impresoras');
},
getByIdPuntoVenta: function (id) {
return $http.get(API_ENDPOINT.URL_AUTOSERVICIO + '/get/punto-venta/' + id);
},
};
}
]);