Complete transformation to htmx

This commit is contained in:
Caleb Gardner
2024-11-01 04:00:55 -05:00
parent 6965917e76
commit 1061a38c6a
9 changed files with 215 additions and 127 deletions
+6 -2
View File
@@ -21,7 +21,7 @@ func filesRequest(w http.ResponseWriter, r *http.Request) {
if err != nil {
if os.IsNotExist(err) {
pageContent = "<p>404 Not Found</p>"
w.WriteHeader(http.StatusNotFound)
// w.WriteHeader(http.StatusNotFound)
} else {
pageContent = "<p>Server error!</p>"
w.WriteHeader(http.StatusInternalServerError)
@@ -52,5 +52,9 @@ func filesRequest(w http.ResponseWriter, r *http.Request) {
return
}
}
sendContent(w, r, pageContent, "Files", "")
if r.Header.Get("Hx-Request") == "true" {
w.Write([]byte(pageContent))
} else {
sendContent(w, r, pageContent, "Files", "")
}
}