()
| 40 | } |
| 41 | |
| 42 | function 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 | |
| 51 | function weatherDetails(info){ |
| 52 | if(info.cod == "404"){ |
no test coverage detected