diff --git a/views/pages/index.go b/views/pages/index.go index 25320eb..356e1ed 100644 --- a/views/pages/index.go +++ b/views/pages/index.go @@ -5,7 +5,6 @@ import ( "time" "github.com/ordinary-dev/phoenix/database" - log "github.com/sirupsen/logrus" ) func ShowMainPage(w http.ResponseWriter, r *http.Request) { @@ -38,12 +37,9 @@ func ShowMainPage(w http.ResponseWriter, r *http.Request) { style = "list" } - err = Render("index.html.tmpl", w, map[string]any{ + Render("index.html.tmpl", w, map[string]any{ "description": "Self-hosted start page.", "groups": groups, "style": style, }) - if err != nil { - log.Error(err) - } } diff --git a/views/pages/signin.go b/views/pages/signin.go index b02484e..f7cc4e0 100644 --- a/views/pages/signin.go +++ b/views/pages/signin.go @@ -4,22 +4,17 @@ import ( "net/http" "strings" - log "github.com/sirupsen/logrus" - "github.com/ordinary-dev/phoenix/database" "github.com/ordinary-dev/phoenix/jwttoken" ) func ShowSignInForm(w http.ResponseWriter, _ *http.Request) { - err := Render("auth.html.tmpl", w, map[string]any{ + Render("auth.html.tmpl", w, map[string]any{ "title": "Sign in", "description": "Authorization is required to view this page.", "button": "Sign in", "formAction": "/signin", }) - if err != nil { - log.Error(err) - } } func AuthorizeUser(w http.ResponseWriter, r *http.Request) { diff --git a/views/pages/templates.go b/views/pages/templates.go index 575b3e1..9a05c72 100644 --- a/views/pages/templates.go +++ b/views/pages/templates.go @@ -59,12 +59,15 @@ func LoadTemplates() error { return nil } -func Render(template string, wr io.Writer, data map[string]any) error { +func Render(template string, wr io.Writer, data map[string]any) { data["fontFamily"] = config.Cfg.FontFamily if _, ok := data["title"]; !ok { data["title"] = config.Cfg.Title } - return templates[template].Execute(wr, data) + err := templates[template].Execute(wr, data) + if err != nil { + log.WithField("template", template).Error(err) + } }