package main import ( "fagott.pw/grilist/grilist" "github.com/julienschmidt/httprouter" "net/http" ) func viewDashboard(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { user, err := app.Charakterin.GetUserFromRequest(r) if err != nil { http.Redirect(w, r, "/", 302) return } var categories []grilist.DashboardCategory for _, module := range app.Modules { for _, category := range module.ProvideDashboardData(user) { if len(category.Cards) > 0 { categories = append(categories, category) } } } data := make(map[string]interface{}) data["categories"] = categories app.Renderer.RenderPage("dashboard", w, data) }