feat(transaction): #87 add filter capabillities
This commit was merged in pull request #106.
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user