-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFDB.js
52 lines (47 loc) · 1.13 KB
/
FDB.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
43
44
45
46
47
48
49
50
51
52
export function log(a){
console.log(a);
}
let hospital_data = [
{
patient_name:"Tanya Chifodya",
patient_age:"27",
gestation:"31",
},
{
patient_name:"Danai Gwatidza",
patient_age:"25",
gestation:"12",
},
{
patient_name:"Millicent Bene",
patient_age:"24",
gestation:"23",
},
{
patient_name:"Cheryl Bulande",
patient_age:"26",
gestation:"28",
}
];
export function ViewList(a){
if(Array.isArray(a)){
console.table(a);
}else{
console.error(`data is not Array`);
console.error(`Expecting ad Array [] but got -> ${a}`);
}
}
export function online(data){
fetch(data,{mode: 'no-cors'}).
then((Response)=>{
console.log('%c Resource is Online ', 'background: white; color: #00aeff');
}).catch((error)=>{
console.log('%c Resource not Online ', 'background: white; color: red');
});
}
export function JsonData(url){
return fetch(url)
.then(response => response.json())
.then(json =>{console.table(json)})
.catch(e=>log(`Failed ${e}`));
}