fix: Invalid reload button hx-get URL #155

This commit is contained in:
Cristian Ditaputratama 2024-11-07 01:30:25 +07:00
parent 98dcdfa94a
commit 2e361a9fab
Signed by: ditatompel
GPG key ID: 31D3D06D77950979
2 changed files with 3 additions and 3 deletions

View file

@ -68,7 +68,7 @@ templ DtRefreshInterval(url, hxTarget, interval string, q interface{}) {
templ DtReload(url, hxTarget string, q interface{}) { templ DtReload(url, hxTarget string, q interface{}) {
<button <button
class="py-2 px-3 inline-flex items-center gap-x-2 text-sm font-bold rounded-full border border-transparent bg-orange-600 text-white hover:bg-orange-500 focus:outline-none" class="py-2 px-3 inline-flex items-center gap-x-2 text-sm font-bold rounded-full border border-transparent bg-orange-600 text-white hover:bg-orange-500 focus:outline-none"
hx-get={ fmt.Sprintf("%s?%s", hxTarget, paging.EncodedQuery(q, []string{""})) } hx-get={ fmt.Sprintf("%s?%s", url, paging.EncodedQuery(q, []string{""})) }
hx-push-url="false" hx-push-url="false"
hx-target={ hxTarget } hx-target={ hxTarget }
hx-swap="outerHTML" hx-swap="outerHTML"

View file

@ -293,9 +293,9 @@ func DtReload(url, hxTarget string, q interface{}) templ.Component {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var15 string var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%s?%s", hxTarget, paging.EncodedQuery(q, []string{""}))) templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%s?%s", url, paging.EncodedQuery(q, []string{""})))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/handler/views/partial_datatable.templ`, Line: 71, Col: 79} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/handler/views/partial_datatable.templ`, Line: 71, Col: 74}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {