https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42732 --- Comment #5 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200636 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200636&action=edit Bug 42732: Migrate catalogue/detail.tt addToBundle $.post to api-client.js Replace direct $.post() to /api/v1/items/{id}/bundled_items with ItemAPIClient.bundled_items.add(), which uses http-client.js and automatically includes the CSRF token header. The caller passes return_response: true because it needs access to the raw response status code and body for fine-grained error handling (different user-facing messages for 409/already_bundled, 409/checked_out, 409/reserved, 404/not_found, 400/failed_nesting). http-client.js default behavior throws a plain Error on non-2xx responses, losing the status code and error_code fields the UI needs. Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.