Files
LazyPM/pkg/web/handler/index.go
Robin Olsen 2e4185e30f use beads service
use pointes for comments
use htmx routing
2026-02-22 11:03:31 +01:00

33 lines
629 B
Go

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)
hx := HTMX(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,
},
}
if hx.IsHxRequest() {
routes.IndexContent(props).Render(r.Context(), w)
return
}
routes.Index(props).Render(r.Context(), w)
}