confirmation response template

This commit is contained in:
Bronku 2025-01-28 19:50:13 +01:00
parent 9734d4abf6
commit 28a3ca3bb4
3 changed files with 9 additions and 2 deletions

View file

@ -3,6 +3,7 @@ package main
import (
"embed"
"fmt"
"html/template"
"io/fs"
"net/http"
)
@ -10,6 +11,9 @@ import (
//go:embed public
var public embed.FS
//go:embed templates
var templates embed.FS
func unwrap[T any](output T, err error) T {
if err != nil {
panic(err)
@ -23,8 +27,10 @@ func handlePost(w http.ResponseWriter, r *http.Request) {
if err != nil {
fmt.Println(err)
}
fmt.Println(r.Form)
w.WriteHeader(http.StatusAccepted)
fmt.Println(r.Form)
tmpl, _ := template.ParseFS(templates, "templates/order/confirmation.html")
_ = tmpl.Execute(w, struct{ Status string }{Status: "accepted"})
}
func main() {