#109 move last url to new layout
Some checks failed
Build Docker Image / Explore-Gitea-Actions (push) Failing after 7s

This commit is contained in:
Tim
2024-08-24 13:40:03 +02:00
parent b9190487bd
commit 148d064858
12 changed files with 92 additions and 170 deletions

View File

@@ -7,7 +7,7 @@ import (
"github.com/a-h/templ"
)
func HandleStaticUi(w http.ResponseWriter, r *http.Request) {
func HandleIndexAnd404(w http.ResponseWriter, r *http.Request) {
var comp templ.Component = nil
if r.URL.Path != "/" {
comp = templates.Layout(templates.NotFound())

View File

@@ -1,6 +1,7 @@
package service
import (
"me-fit/templates"
"me-fit/utils"
"database/sql"
@@ -22,6 +23,13 @@ var (
)
)
func App(w http.ResponseWriter, r *http.Request) {
comp := templates.App()
layout := templates.Layout(comp)
layout.Render(r.Context(), w)
w.WriteHeader(http.StatusOK)
}
func NewWorkout(db *sql.DB) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
metrics.WithLabelValues("new").Inc()