-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.js
More file actions
26 lines (21 loc) · 1.06 KB
/
page.js
File metadata and controls
26 lines (21 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import * as axios from 'axios';
//quick function to collect information about mars weather
const get_mars_weather = () => {
axios
.get("https://api.maas2.apollorion.com/")
.then((res) => {
console.log(res.data, 'heres the response')
document.getElementById("marsWeatherSol").innerHTML = `Sol: ${res.data.sol}`;
document.getElementById("marsWeatherMaxtemp").innerHTML = `Max Temperature: ${res.data.max_temp}c`
document.getElementById("marsWeatherMintemp").innerHTML = `Min Temperature: ${res.data.min_temp}c`
document.getElementById("marsWeatherPressure").innerHTML = `Pressure ${res.data.sol} Pa`
document.getElementById("marsWeatherSunrise").innerHTML = `Sunrise: ${res.data.sunrise}`
document.getElementById("marsWeatherSunset").innerHTML = `Sunset: ${res.data.sunset}`
return res
})
.catch((err) => {
console.log('there was an issue getting response from nasa website', err)
return err
})
}
get_mars_weather();