summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorsiddharth ravikumar <s@ricketyspace.net>2022-06-12 19:41:06 -0400
committersiddharth ravikumar <s@ricketyspace.net>2022-06-12 19:41:06 -0400
commit16a8651571e7e489e1d22c5546db0153608bb48a (patch)
tree8acbedb849d021e000db4109182cd2c1d948237a /main.go
parent7abdb69a69c793a153275e8645253a6ba5f05721 (diff)
weather: update NewWeather
Change arguments to just `lat`, `lng`. Make this function call NWS directly.
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files changed, 2 insertions, 10 deletions
diff --git a/main.go b/main.go
index 7cfe341..b9bd1b1 100644
--- a/main.go
+++ b/main.go
@@ -14,7 +14,6 @@ import (
"strconv"
"strings"
- "ricketyspace.net/peach/nws"
"ricketyspace.net/peach/photon"
"ricketyspace.net/peach/version"
"ricketyspace.net/peach/weather"
@@ -93,17 +92,10 @@ func main() {
}
func showWeather(w http.ResponseWriter, lat, lng float32) {
- forecastBundle, nwsErr := nws.GetForecastBundle(lat, lng)
- if nwsErr != nil {
- http.Error(w, nwsErr.Error(), nwsErr.Status)
- }
-
// Make weather
- weather, err := weather.NewWeather(forecastBundle.Point,
- forecastBundle.Forecast,
- forecastBundle.ForecastHourly)
+ weather, err, status := weather.NewWeather(lat, lng)
if err != nil {
- http.Error(w, err.Error(), 500)
+ http.Error(w, err.Error(), status)
return
}