package web import ( "log" root "marmic/servicetrade-toolbox" "marmic/servicetrade-toolbox/internal/api" "net/http" ) func AdminHandler(w http.ResponseWriter, r *http.Request) { session, ok := r.Context().Value("session").(*api.Session) if !ok { http.Error(w, "Unauthorized", http.StatusUnauthorized) return } tmpl := root.WebTemplates data := map[string]interface{}{ "Title": "Admin Dashboard", "Session": session, } if err := tmpl.ExecuteTemplate(w, "admin.html", data); err != nil { log.Printf("Template execution error: %v", err) http.Error(w, "Internal Server Error", http.StatusInternalServerError) return } }