-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpacienteAndes.ts
More file actions
30 lines (29 loc) · 1.03 KB
/
pacienteAndes.ts
File metadata and controls
30 lines (29 loc) · 1.03 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
import * as http from 'http';
import * as config from './config';
export class PacienteAndes {
borraUnPacienteAndes(paciente: any, token: any) {
return new Promise((resolve, reject) => {
let options = {
host: config.hostApi,
port: config.portApi,
path: config.pathPaciente + '/' + paciente._id,
method: 'DELETE',
headers: {
'Authorization': token,
'Content-Type': 'application/json',
}
};
let req = http.request(options, function (res) {
res.on('data', function (body) {
console.log('Se ha borrado el paciente', paciente);
resolve(body);
});
});
req.on('error', function (e) {
console.log('Problemas API al borrar un paciente : ' + e.message + ' ----- ', e);
reject(e.message);
});
req.end();
});
}
}