김시환

Update sample.js

...@@ -37,11 +37,11 @@ const fetchAPI = async () => { ...@@ -37,11 +37,11 @@ const fetchAPI = async () => {
37 37
38 return fetch(request).then(async res => { 38 return fetch(request).then(async res => {
39 const data = await res.json(); 39 const data = await res.json();
40 - 40 + if(data.route != undefined){
41 const distance = data.route?.trafast[0].summary.distance; 41 const distance = data.route?.trafast[0].summary.distance;
42 const duration = data.route?.trafast[0].summary.duration; 42 const duration = data.route?.trafast[0].summary.duration;
43 addrData["hospital_data"][idx].distance = distance; 43 addrData["hospital_data"][idx].distance = distance;
44 - addrData["hospital_data"][idx].duration = duration; 44 + addrData["hospital_data"][idx].duration = duration;}
45 }); 45 });
46 }) 46 })
47 47
......