feat(transaction): #87 add filter capabillities
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 4m30s
Build and Push Docker Image / Build-And-Push-Docker-Image (push) Successful in 4m6s

This commit was merged in pull request #106.
This commit is contained in:
2025-05-18 16:52:50 +02:00
parent 989a31afd1
commit 36e480f2ea
7 changed files with 198 additions and 151 deletions

View File

@@ -10,7 +10,7 @@ import (
)
func TriggerToast(w http.ResponseWriter, r *http.Request, class string, message string) {
if isHtmx(r) {
if IsHtmx(r) {
w.Header().Set("HX-Trigger", fmt.Sprintf(`{"toast": "%v|%v"}`, class, strings.ReplaceAll(message, `"`, `\"`)))
} else {
log.Error("Trying to trigger toast in non-HTMX request")
@@ -23,7 +23,7 @@ func TriggerToastWithStatus(w http.ResponseWriter, r *http.Request, class string
}
func DoRedirect(w http.ResponseWriter, r *http.Request, url string) {
if isHtmx(r) {
if IsHtmx(r) {
w.Header().Add("HX-Redirect", url)
} else {
http.Redirect(w, r, url, http.StatusSeeOther)
@@ -37,6 +37,6 @@ func WaitMinimumTime[T interface{}](waitTime time.Duration, function func() (T,
return result, err
}
func isHtmx(r *http.Request) bool {
func IsHtmx(r *http.Request) bool {
return r.Header.Get("HX-Request") == "true"
}