From 73be26e7167e6a84f523106876efaf2f59e298a4 Mon Sep 17 00:00:00 2001 From: BrookJeynes Date: Mon, 12 May 2025 15:07:35 +0000 Subject: [PATCH] appview: pages: Add HXRefresh helper function. --- appview/pages/htmx.go | 6 ++++++ 1 file(s) changed, 6 insertion(s)(+), 0 deletion(s)(-) diff --git a/appview/pages/htmx.go b/appview/pages/htmx.go --- a/appview/pages/htmx.go +++ b/appview/pages/htmx.go @@ -15,6 +15,12 @@ w.Write([]byte(html)) } +// HxRefresh is a client-side full refresh of the page. +func (s *Pages) HxRefresh(w http.ResponseWriter) { + w.Header().Set("HX-Refresh", "true") + w.WriteHeader(http.StatusOK) +} + // HxRedirect is a full page reload with a new location. func (s *Pages) HxRedirect(w http.ResponseWriter, location string) { w.Header().Set("HX-Redirect", location) -- tangled.sh