From 4534dffb865eb1a50bfbc291a5c3798183081caf Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sun, 26 May 2024 20:33:37 +0200 Subject: feat: Add actual git listing implementation --- pkg/handler/git.go | 9 ++++++++- pkg/handler/status.go | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'pkg/handler') diff --git a/pkg/handler/git.go b/pkg/handler/git.go index 5b09121..1ed2c49 100644 --- a/pkg/handler/git.go +++ b/pkg/handler/git.go @@ -1,6 +1,7 @@ package handler import ( + "log/slog" "net/http" "git.gabrielgio.me/cerrado/pkg/service" @@ -16,6 +17,12 @@ func NewGitHandler(gitService *service.GitService) *GitHandler { } func (g *GitHandler) List(w http.ResponseWriter, _ *http.Request) { - gitList := &templates.GitListPage{g.gitService.ListRepositories()} + repos, err := g.gitService.ListRepositories() + if err != nil { + slog.Error("Error listing repo", "error", err) + return + } + + gitList := &templates.GitListPage{repos} templates.WritePageTemplate(w, gitList) } diff --git a/pkg/handler/status.go b/pkg/handler/status.go index 2a84a7e..1ca7f70 100644 --- a/pkg/handler/status.go +++ b/pkg/handler/status.go @@ -19,7 +19,7 @@ func ConfigFile(configPath string) func(http.ResponseWriter, *http.Request) { return func(w http.ResponseWriter, _ *http.Request) { f, err := os.Open(configPath) if err != nil { - slog.Error("Error openning config file json", "error", err, "path", configPath) + slog.Error("Error openning config file", "error", err, "path", configPath) return } -- cgit v1.2.3