diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-13 01:28:35 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-13 01:28:35 +0800 |
commit | 14326ba9be276d2649b4681d3ebed1c32f65013f (patch) | |
tree | 9bd8717b6968b5a977d925d193042a92bc68f311 /http_handle_index.go | |
parent | ssh_{server,utils}: Swap filenames (diff) | |
download | forge-14326ba9be276d2649b4681d3ebed1c32f65013f.tar.gz forge-14326ba9be276d2649b4681d3ebed1c32f65013f.tar.zst forge-14326ba9be276d2649b4681d3ebed1c32f65013f.zip |
_header.html: Add header
Diffstat (limited to '')
-rw-r--r-- | http_handle_index.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/http_handle_index.go b/http_handle_index.go index bf36f98..4448272 100644 --- a/http_handle_index.go +++ b/http_handle_index.go @@ -4,10 +4,7 @@ import ( "net/http" ) -func handle_index(w http.ResponseWriter, r *http.Request) { - data := make(map[string]any) - data["global"] = global_data - +func handle_index(w http.ResponseWriter, r *http.Request, params map[string]any) { rows, err := database.Query(r.Context(), "SELECT name FROM groups") if err != nil { _, _ = w.Write([]byte("Error querying groups: " + err.Error())) @@ -30,9 +27,9 @@ func handle_index(w http.ResponseWriter, r *http.Request) { return } - data["groups"] = groups + params["groups"] = groups - err = templates.ExecuteTemplate(w, "index", data) + err = templates.ExecuteTemplate(w, "index", params) if err != nil { _, _ = w.Write([]byte("Error rendering template: " + err.Error())) return |