cerrado @ 60e8e751c76d949a28eefe0c5462e0cf17337217

 1package handler
 2
 3import (
 4	"log/slog"
 5	"net/http"
 6
 7	"git.gabrielgio.me/cerrado/pkg/service"
 8	"git.gabrielgio.me/cerrado/templates"
 9)
10
11type GitHandler struct {
12	gitService *service.GitService
13}
14
15func NewGitHandler(gitService *service.GitService) *GitHandler {
16	return &GitHandler{gitService}
17}
18
19func (g *GitHandler) List(w http.ResponseWriter, _ *http.Request) {
20	repos, err := g.gitService.ListRepositories()
21	if err != nil {
22		slog.Error("Error listing repo", "error", err)
23		return
24	}
25
26	gitList := &templates.GitListPage{repos}
27	templates.WritePageTemplate(w, gitList)
28}