move to templ
This commit is contained in:
parent
31a33cc220
commit
bb32802324
34 changed files with 1011 additions and 528 deletions
|
|
@ -7,10 +7,13 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/a-h/templ"
|
||||
|
||||
"git.bronku.xyz/bronku/cake-order-tracker/models"
|
||||
"git.bronku.xyz/bronku/cake-order-tracker/server/templates"
|
||||
)
|
||||
|
||||
func (h *Server) postCake(r *http.Request) (any, int, error) {
|
||||
func (h *Server) postCake(r *http.Request) (templ.Component, int, error) {
|
||||
err := r.ParseForm()
|
||||
if err != nil {
|
||||
return nil, http.StatusInternalServerError, err
|
||||
|
|
@ -28,10 +31,10 @@ func (h *Server) postCake(r *http.Request) (any, int, error) {
|
|||
}
|
||||
n.ID, err = h.s.SaveCake(n)
|
||||
fmt.Println(err)
|
||||
return n, http.StatusAccepted, err
|
||||
return templates.Confirmation("Potwierdzone", n.ID), http.StatusAccepted, err
|
||||
}
|
||||
|
||||
func (h *Server) postOrder(r *http.Request) (any, int, error) {
|
||||
func (h *Server) postOrder(r *http.Request) (templ.Component, int, error) {
|
||||
cakes, err := h.s.GetCakes()
|
||||
if err != nil {
|
||||
return nil, http.StatusInternalServerError, err
|
||||
|
|
@ -75,5 +78,5 @@ func (h *Server) postOrder(r *http.Request) (any, int, error) {
|
|||
|
||||
n.ID, err = h.s.SaveOrder(n)
|
||||
fmt.Println(n)
|
||||
return n, http.StatusAccepted, err
|
||||
return templates.Confirmation("Potwierdzone", n.ID), http.StatusAccepted, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue