package restgallery

import (
	"log/slog"
	"net/http"

	"git.schreifuchs.ch/schreifuchs/schreifuchs.ch/web/pages"
)

func (h *Handler) gallery(w http.ResponseWriter, r *http.Request) {
	imgs, err := h.srv.GetGallerySet(r.Context())
	if err != nil {
		slog.Error("could not get images", "err", err)
		w.WriteHeader(http.StatusInternalServerError)
		return
	}
	h.r.Render(r.Context(), w, r, pages.GallerySet(imgs))
}
