From 16a8651571e7e489e1d22c5546db0153608bb48a Mon Sep 17 00:00:00 2001 From: siddharth ravikumar Date: Sun, 12 Jun 2022 19:41:06 -0400 Subject: weather: update NewWeather Change arguments to just `lat`, `lng`. Make this function call NWS directly. --- main.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'main.go') 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 } -- cgit v1.2.3