aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/api_items.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/admin/api_items.go')
-rw-r--r--internal/admin/api_items.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/admin/api_items.go b/internal/admin/api_items.go
index 3ab20ae..d5e707e 100644
--- a/internal/admin/api_items.go
+++ b/internal/admin/api_items.go
@@ -11,15 +11,15 @@ import (
func (s *AdminServer) handleItems(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case http.MethodGet:
- ids, err := listYAMLFiles(s.dataDir, "items")
+ tree, err := listYAMLTree(s.dataDir, "items")
if err != nil {
http.Error(w, `{"error":"failed to list items"}`, http.StatusInternalServerError)
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.createItem(w, r)
default: