post order

This commit is contained in:
bronku 2026-06-16 16:54:35 +02:00
parent 4666618151
commit c540ccc28e
5 changed files with 38 additions and 37 deletions

View file

@ -10,11 +10,6 @@ import (
"github.com/a-h/templ"
)
type httpError struct {
code int
error
}
type fetcher[T any] func(r *http.Request) (T, *httpError)
type templateBuilder[T any] func(data T) templ.Component
@ -64,10 +59,11 @@ func New(store *store.Store) *Server {
mux.HandleFunc("GET /", redirect("/orders", http.StatusSeeOther))
mux.HandleFunc("GET /order", render("Nowe zamówienie", server.newOrder, templates.OrderForm))
mux.HandleFunc("GET /order/{id}", render("Zamówienie", server.order, templates.OrderForm))
mux.HandleFunc("POST /order", render("Potwierdzenie", server.postOrder, templates.Confirmation))
mux.HandleFunc("POST /order/{id}", render("Potwierdzenie", server.postOrder, templates.Confirmation))
// mux.HandleFunc("GET /orders", render(server.orders))
// mux.HandleFunc("GET /cake", render(server.cake))
// mux.HandleFunc("GET /cakes", render(server.cakes))
// mux.HandleFunc("POST /order", render(server.postOrder))
// mux.HandleFunc("POST /order/{id}/status", render(server.updateStatus))
// mux.HandleFunc("POST /cake", render(server.postCake))
// mux.HandleFunc("GET /blocked", render(server.blocked))