Update. Add svelte admin frontend
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user