fix(api): bringAddItems() missing $input/$items decode — always returned 0
bringAddItems() used $input and $items without ever decoding the request
body. $items was undefined (null) so the foreach never ran, every call
returned added=0 skipped=0 regardless of what was sent.
Added:
$input = json_decode(file_get_contents('php://input'), true) ?? [];
$items = $input['items'] ?? [];
Also added the missing $auth guard (consistent with all other Bring functions).
This commit is contained in:
@@ -4672,6 +4672,13 @@ function bringGetList(): void {
|
|||||||
|
|
||||||
function bringAddItems(): void {
|
function bringAddItems(): void {
|
||||||
$auth = bringAuth();
|
$auth = bringAuth();
|
||||||
|
if (!$auth) {
|
||||||
|
echo json_encode(['success' => false, 'error' => 'Credenziali Bring! non configurate']);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$input = json_decode(file_get_contents('php://input'), true) ?? [];
|
||||||
|
$items = $input['items'] ?? [];
|
||||||
$listUUID = $input['listUUID'] ?? $auth['bringListUUID'];
|
$listUUID = $input['listUUID'] ?? $auth['bringListUUID'];
|
||||||
|
|
||||||
if (empty($listUUID)) {
|
if (empty($listUUID)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user