MCPcopy Create free account
hub / github.com/codemistic/Web-Development / fetchData

Function fetchData

Weather Forecast Webapp/js/script.js:42–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40}
41
42function fetchData(){
43 infoTxt.innerText = "Getting weather details...";
44 infoTxt.classList.add("pending");
45 fetch(api).then(res => res.json()).then(result => weatherDetails(result)).catch(() =>{
46 infoTxt.innerText = "Something went wrong";
47 infoTxt.classList.replace("pending", "error");
48 });
49}
50
51function weatherDetails(info){
52 if(info.cod == "404"){

Callers 2

requestApiFunction · 0.70
onSuccessFunction · 0.70

Calls 1

weatherDetailsFunction · 0.85

Tested by

no test coverage detected