fix(manage): HandleReorderUI gibt 400 bei Mismatch zurück

This commit is contained in:
Jesko Anschütz 2026-03-26 22:27:07 +01:00
parent 1c11aa9877
commit 4fab5fe28a

View file

@ -3,6 +3,7 @@ package manage
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"errors"
"html/template" "html/template"
"log/slog" "log/slog"
"net/http" "net/http"
@ -741,7 +742,11 @@ func HandleReorderUI(playlists *store.PlaylistStore, screens *store.ScreenStore,
return return
} }
if err := playlists.Reorder(r.Context(), playlist.ID, ids); err != nil { if err := playlists.Reorder(r.Context(), playlist.ID, ids); err != nil {
if errors.Is(err, store.ErrReorderMismatch) {
http.Error(w, "item list mismatch", http.StatusBadRequest)
} else {
http.Error(w, "db error", http.StatusInternalServerError) http.Error(w, "db error", http.StatusInternalServerError)
}
return return
} }
notifier.NotifyChanged(screenSlug) notifier.NotifyChanged(screenSlug)