From 8728b321abac752fb5f0b058ebf25f61c520b5b1 Mon Sep 17 00:00:00 2001 From: Robin Olsen Date: Fri, 13 Feb 2026 13:40:00 +0100 Subject: [PATCH] rename to index and use new middlewares and chi --- pkg/web/handler/index.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 pkg/web/handler/index.go diff --git a/pkg/web/handler/index.go b/pkg/web/handler/index.go new file mode 100644 index 0000000..6cec171 --- /dev/null +++ b/pkg/web/handler/index.go @@ -0,0 +1,26 @@ +package handler + +import ( + "net/http" + + "github.com/LazyBachelor/LazyPM/pkg/web/components" + "github.com/LazyBachelor/LazyPM/pkg/web/routes" +) + +func IndexHandler(w http.ResponseWriter, r *http.Request) { + svc := Services(r) + + issues, err := svc.Beads.AllIssues(r.Context()) + if err != nil { + http.Error(w, "failed to retrieve issues", http.StatusInternalServerError) + return + } + + props := routes.IndexProps{ + IssueTable: components.IssueTableProps{ + Issues: issues, + }, + } + + routes.Index(props).Render(r.Context(), w) +}