Add in context to dashboard for user to topbar loads all items & refactor for clarity of variable extraction.

This commit is contained in:
2025-04-23 15:29:34 +01:00
parent b5f1b17684
commit 0634876b75
8 changed files with 47 additions and 30 deletions

View File

@@ -13,7 +13,8 @@ import (
func NewDrawHandler(db *sql.DB) http.HandlerFunc {
return httpHelpers.AuthMiddleware(func(w http.ResponseWriter, r *http.Request) {
context := templateHelpers.TemplateContext(w, r, models.TemplateData{})
data := models.TemplateData{}
context := templateHelpers.TemplateContext(w, r, data)
if r.Method == http.MethodPost {
game := r.FormValue("game_type")
@@ -74,7 +75,8 @@ func DeleteDrawHandler(db *sql.DB) http.HandlerFunc {
func ListDrawsHandler(db *sql.DB) http.HandlerFunc {
return httpHelpers.AuthMiddleware(func(w http.ResponseWriter, r *http.Request) {
context := templateHelpers.TemplateContext(w, r, models.TemplateData{})
data := models.TemplateData{}
context := templateHelpers.TemplateContext(w, r, data)
draws := []models.DrawSummary{}
rows, err := db.Query(`