fix(manage): HandleReorderUI gibt 400 bei Mismatch zurück
This commit is contained in:
parent
1c11aa9877
commit
4fab5fe28a
1 changed files with 6 additions and 1 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue