diff --git a/cmd/serverFunc.go b/cmd/serverFunc.go
index fcae361..a2d17f4 100644
--- a/cmd/serverFunc.go
+++ b/cmd/serverFunc.go
@@ -28,7 +28,7 @@ func server() {
LoadHTMLFromEmbedFS(r, templatesFolder, "templates/*.html")
r.StaticFileFS("/style.css", "./templates/style.css", http.FS(templatesFolder))
- r.GET("/", autoDetectProvince)
+ r.GET("/", chooseProvince)
r.GET("/:local", returnProvince)
r.GET("/api/:localidad", returnAPIWeather)
r.GET("/api/:localidad/:dia", returnAPIWeather)
@@ -36,16 +36,13 @@ func server() {
r.Run(":" + listenPort)
}
-func autoDetectProvince(c *gin.Context) {
- // c.HTML(http.StatusOK, "templates/index.html", gin.H{
- // "title": "Hello world!",
- // })
-
- // TODO: Try to autodetect the province of the IP and show the correct corresponding weather
+func chooseProvince(c *gin.Context) {
+ c.HTML(http.StatusOK, "templates/redirect.html", gin.H{
+ "Localidades": localidades,
+ })
}
func returnProvince(c *gin.Context) {
- // TODO: Return prettified HTML representation of the weather based on url parameter
localidad := c.Param("local")
if isAv := localityIsAvailable(localidad); isAv != true {
c.String(http.StatusNotFound, "The locality doesn't exist or is currently not supported, sorry\n")
@@ -56,7 +53,6 @@ func returnProvince(c *gin.Context) {
if err != nil {
e := fmt.Sprint(err)
c.String(http.StatusInternalServerError, e)
- //c.String(500, jsonData)
return
}
diff --git a/cmd/templates/index.html b/cmd/templates/index.html
index db6c327..9c1fb80 100644
--- a/cmd/templates/index.html
+++ b/cmd/templates/index.html
@@ -13,22 +13,22 @@