confirmation response template
This commit is contained in:
parent
9734d4abf6
commit
28a3ca3bb4
3 changed files with 9 additions and 2 deletions
8
main.go
8
main.go
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue