-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpaciente.service.ts
More file actions
38 lines (34 loc) · 1.35 KB
/
paciente.service.ts
File metadata and controls
38 lines (34 loc) · 1.35 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
import * as http from 'http';
import * as configPrivate from './config.private';
export class PacienteMpi {
cuilificaPaciente(patient: any, token: any) {
return new Promise((resolve: any, reject: any) => {
let id = patient._id;
// delete paciente._id; //Borro el id para que no se duplique
let options = {
host: configPrivate.network.host,
port: configPrivate.network.port,
path: configPrivate.URL.base + '/' + id,
method: 'PATCH',
headers: {
'Authorization': token,
'Content-Type': 'application/json',
}
};
let req = http.request(options, function (res) {
res.on('data', function (result) {
// console.log('paciente actualizado: ', patient.apellido, patient.nombre, patient.documento);
console.log("Pepepe: ", req)
resolve(result);
});
});
req.on('error', function (e) {
console.log('Problemas API en update : ' + e.message + ' ----- ', e);
reject(e.message);
});
/*write data to request body*/
req.write(JSON.stringify({ op: 'updateCuil', cuil: patient.cuil }));
req.end();
});
};
}