feat(webui): implement states list
This commit is contained in:
parent
7885b19b54
commit
09885ef1e4
10 changed files with 117 additions and 12 deletions
|
@ -1,16 +1,16 @@
|
|||
package webui
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
var indexTemplates = template.Must(template.ParseFS(htmlFS, "html/base.html", "html/index.html"))
|
||||
|
||||
func handleIndexGET() http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Cache-Control", "no-store, no-cache")
|
||||
|
||||
render(w, indexTemplates, http.StatusOK, nil)
|
||||
if r.URL.Path == "/" {
|
||||
http.Redirect(w, r, "/states", http.StatusFound)
|
||||
} else {
|
||||
errorResponse(w, http.StatusNotFound, fmt.Errorf("Page not found"))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue