diff options
Diffstat (limited to 'internal/admin/api_drops.go')
| -rw-r--r-- | internal/admin/api_drops.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/admin/api_drops.go b/internal/admin/api_drops.go index 3724a6c..4cb0ae9 100644 --- a/internal/admin/api_drops.go +++ b/internal/admin/api_drops.go @@ -15,7 +15,7 @@ func (s *AdminServer) handleDrops(w http.ResponseWriter, r *http.Request) { case http.MethodGet: tree, err := listYAMLTree(s.dataDir, "drops") if err != nil { - writeJSON(w, map[string]any{"error": err.Error()}) + failJSON(w, err.Error()) return } if tree == nil { @@ -44,17 +44,17 @@ func (s *AdminServer) handleDropByID(w http.ResponseWriter, r *http.Request) { switch r.Method { case http.MethodGet: - s.getDrop(w, r, id) + s.getDrop(w, id) case http.MethodPut: s.updateDrop(w, r, id) case http.MethodDelete: - s.deleteDrop(w, r, id) + s.deleteDrop(w, id) default: http.Error(w, `{"error":"method not allowed"}`, http.StatusMethodNotAllowed) } } -func (s *AdminServer) getDrop(w http.ResponseWriter, r *http.Request, id string) { +func (s *AdminServer) getDrop(w http.ResponseWriter, id string) { data, path, err := readYAMLFile(s.dataDir, "drops", id) if err != nil { http.Error(w, `{"error":"drop not found"}`, http.StatusNotFound) @@ -108,7 +108,7 @@ func (s *AdminServer) updateDrop(w http.ResponseWriter, r *http.Request, id stri writeJSON(w, m) } -func (s *AdminServer) deleteDrop(w http.ResponseWriter, r *http.Request, id string) { +func (s *AdminServer) deleteDrop(w http.ResponseWriter, id string) { _, path, err := readYAMLFile(s.dataDir, "drops", id) if err != nil { http.Error(w, `{"error":"drop not found"}`, http.StatusNotFound) |
