(icaoCode)
| 84 | * @returns {object} |
| 85 | */ |
| 86 | export const getCurrentAirportWeather = async (icaoCode) => { |
| 87 | const airportWeather = await axios.get( |
| 88 | `${CPTEC_URL}/estacao/${icaoCode}/condicoesAtuais.xml`, |
| 89 | { |
| 90 | responseType: 'application/xml', |
| 91 | responseEncoding: 'utf-8', |
| 92 | } |
| 93 | ); |
| 94 | const parsed = parser.parse(airportWeather.data); |
| 95 | |
| 96 | if (parsed.metar) { |
| 97 | return formatMetar(parsed.metar); |
| 98 | } |
| 99 | return []; |
| 100 | }; |
| 101 | |
| 102 | /** |
| 103 | * Get weather predicion for the next 7 days with location based |