Add product editing

This commit is contained in:
Achim Rohn
2025-08-02 11:35:06 +02:00
parent 85509392b3
commit 0de3e04d68
+24
View File
@@ -0,0 +1,24 @@
package htmx
import (
"encoding/json"
"ersteller-lib"
"github.com/labstack/echo/v4"
)
type LocationRedirectParams struct {
Path string `json:"path"`
Target string `json:"target,omitempty"`
Swap string `json:"swap,omitempty"`
}
func LocationRedirect(c echo.Context, params LocationRedirectParams) error {
jsonData, err := json.Marshal(params)
if err != nil {
ersteller_lib.Error("Failed to marshal LocationRedirectParams ", params, err)
return err
}
ersteller_lib.Debug("LocationRedirectParams", params, "jsonData", string(jsonData))
c.Response().Header().Set("HX-Location", string(jsonData))
return nil
}