From fee376102192dc6f24297a7b11324636ace3a07d Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 30 Jun 2026 19:27:37 -0400 Subject: feat: admin gui object CRUD is much nicer --- internal/admin/api_hazards.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'internal/admin/api_hazards.go') diff --git a/internal/admin/api_hazards.go b/internal/admin/api_hazards.go index c8c0282..405c9ab 100644 --- a/internal/admin/api_hazards.go +++ b/internal/admin/api_hazards.go @@ -11,15 +11,15 @@ import ( func (s *AdminServer) handleHazards(w http.ResponseWriter, r *http.Request) { switch r.Method { case http.MethodGet: - ids, err := listYAMLFiles(s.dataDir, "hazards") + tree, err := listYAMLTree(s.dataDir, "hazards") if err != nil { writeJSON(w, map[string]any{"error": err.Error()}) return } - if ids == nil { - ids = []string{} + if tree == nil { + tree = &YAMLTree{Root: []string{}, Dirs: map[string][]string{}} } - writeJSON(w, ids) + writeJSON(w, tree) case http.MethodPost: s.createHazard(w, r) -- cgit v1.2.3