refactor: fix linter errors

This commit is contained in:
rramiachraf
2024-07-14 00:43:06 +01:00
parent ea14549d6f
commit b6cae441b3
9 changed files with 55 additions and 43 deletions

19
utils/template.go Normal file
View File

@ -0,0 +1,19 @@
package utils
import (
"context"
"net/http"
"github.com/a-h/templ"
)
func RenderTemplate(w http.ResponseWriter, t templ.Component, l *Logger) {
if err := t.Render(context.Background(), w); err != nil {
l.Error("unable to render template %s", err)
w.WriteHeader(http.StatusInternalServerError)
_, err := w.Write([]byte{})
if err != nil {
l.Error(err.Error())
}
}
}