fix bug causing edit tracks component to crash

This commit is contained in:
ari melody 2025-01-24 01:33:14 +00:00
parent 9a27dbdc37
commit 090de0554b
Signed by: ari
GPG key ID: CF99829C92678188
3 changed files with 17 additions and 6 deletions

View file

@ -145,7 +145,16 @@ func serveEditLinks(release *model.Release) http.Handler {
func serveEditTracks(release *model.Release) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html")
err := components["edittracks"].Execute(w, release)
type editTracksData struct {
Release *model.Release
Add func(a int, b int) int
}
err := components["edittracks"].Execute(w, editTracksData{
Release: release,
Add: func(a, b int) int { return a + b },
})
if err != nil {
fmt.Printf("Error rendering edit tracks component for %s: %s\n", release.ID, err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)