use latest templ and ignore content of books dir
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/a-h/templ"
|
||||
"github.com/arnef/ebooks/internal/library"
|
||||
"github.com/arnef/ebooks/views"
|
||||
)
|
||||
@@ -83,9 +84,9 @@ func (h *Handler) downloadBook(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, cleanPath)
|
||||
}
|
||||
|
||||
func render(w http.ResponseWriter, ctx context.Context, page interface{ Render(context.Context, http.ResponseWriter) error }) {
|
||||
func render(w http.ResponseWriter, ctx context.Context, c templ.Component) {
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
if err := page.Render(ctx, w); err != nil && !errors.Is(err, context.Canceled) {
|
||||
if err := c.Render(ctx, w); err != nil && !errors.Is(err, context.Canceled) {
|
||||
http.Error(w, "render failed", http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user