Skip to content

Commit

Permalink
Add some more checks
Browse files Browse the repository at this point in the history
  • Loading branch information
bytehead committed Sep 4, 2023
1 parent d991697 commit daa9022
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/SortableListView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class SortableListView {

formData.append('REQUEST_TOKEN', window.sortableListViews.token)
formData.append('action', action ?? '')
formData.append('id', id ?? '')
formData.append('id', id ?? 0)
formData.append('oldIndex', event.oldIndex)
formData.append('newIndex', event.newIndex)

Expand Down
2 changes: 1 addition & 1 deletion public/backend.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions public/backend.min.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/Service/Sorter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public function __construct(

public function sort(string $table, int $id, int $oldIndex, int $newIndex): void
{
if (0 === $id) {
return;
}

/**
* < 0 --> move downward
* = 0 --> do nothing
Expand Down

0 comments on commit daa9022

Please sign in to comment.