-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.js
31 lines (24 loc) · 825 Bytes
/
api.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
const key = 'key=c7cfdecf'
const URL = `https://api.hgbrasil.com/weather?${key}`
async function obterPrevisao(previsao){
try{
const response = await axios.get(URL, { params:
previsao
})
console.log(response)
return response
} catch (error) {
// if(URL.cod === '404'){
// container.computedStyleMap.height = '400px';
// weatherBox.computedStyleMap.display = 'none';
// weatherDetails.computedStyleMap.display = 'none';
// error404.display.display = 'block';
// error404.classList.add('fadeIn');
// return;
// }
// error404.display.display = 'none';
// error404.classList.remover('fadeIn');
return console.log(error);
}
}
export default obterPrevisao;