summaryrefslogtreecommitdiff
path: root/internal/server/handlers/pages.go
blob: 8c5bfb587af0da9f83dbe51ad601804862b67837 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package handlers

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

	"codeberg.org/mihna123/openstore/internal/config"
)

type Page struct {
	Lang     string
	Instance config.Instance
	Data     any
}

func (h *Handler) home(w http.ResponseWriter, r *http.Request) {
	page := Page{Lang: "en", Instance: h.cfg.Instance}
	err := h.tmpl.ExecuteTemplate(w, "index.html", page)

	if err != nil {
		slog.Error("render template", "err", err.Error())
		return
	}
}