Update. Add svelte admin frontend

This commit is contained in:
2025-06-12 20:38:12 +02:00
parent 17ab7c4929
commit 562186fa47
16 changed files with 463 additions and 165 deletions

View File

@@ -1,6 +1,7 @@
package handlers
import (
"fmt"
"html/template"
"log/slog"
"net/http"
@@ -13,11 +14,12 @@ func AdminHandler() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
tpl := template.Must(template.ParseFS(web.Templates, "templates/admin.html", "templates/base.html"))
viteFragment, err := vite.HTMLFragment(vite.Config{
FS: web.StaticAssets,
FS: web.DistFS(),
IsDev: false,
})
if err != nil {
http.Error(w, "Error instantiating vite fragment", http.StatusInternalServerError)
msg := fmt.Errorf("error instantiating vite fragment: %v", err)
http.Error(w, msg.Error(), http.StatusInternalServerError)
return
}