-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproxy-pregnancy-lens.js
42 lines (35 loc) · 1020 Bytes
/
proxy-pregnancy-lens.js
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
40
41
42
let pvData = pv;
let htmlData = html;
let epiData = epi;
let ipsData = ips;
let getSpecification = () => {
return "1.0.0";
};
let enhance = async () => {
const host = process.env.PROXY_LENS_ENV == "dev" ? "https://gravitate-health.lst.tfo.upm.es" : "https://gravitate-health.lst.tfo.upm.es" //"https://fosps.gravitatehealth.eu/";
const url = `${host}/external/pregnancy`
const options = {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
},
body: JSON.stringify({
pvData: pv,
htmlData: html,
epiData: JSON.stringify(epi),
ipsData: JSON.stringify(ips)
})
};
let response = await fetch(url, options)
.then((response) => {
return response.json();
}).catch((error) => {
throw new Error(error);
});
return response.htmlString;
};
return {
enhance: enhance,
getSpecification: getSpecification,
};