initial commit from original sev version
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"abuse_registration_poc/internal/models"
|
||||
)
|
||||
|
||||
func (h *Handler) Index(writer http.ResponseWriter, request *http.Request) {
|
||||
_, _, nextReset := h.store.Snapshot()
|
||||
data := struct {
|
||||
Version string
|
||||
NextReset string
|
||||
Locations []string
|
||||
Categories []string
|
||||
Genders []string
|
||||
Statuses []string
|
||||
}{
|
||||
Version: h.version,
|
||||
NextReset: nextReset.Format(time.RFC3339),
|
||||
Locations: models.FaroeLocations,
|
||||
Categories: models.AbuseCategories,
|
||||
Genders: models.Genders,
|
||||
Statuses: models.Statuses,
|
||||
}
|
||||
|
||||
writer.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
if err := h.index.ExecuteTemplate(writer, "index.html", data); err != nil {
|
||||
http.Error(writer, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user