const RsvReservationClient = { accept(reservation_id) { return this._post(reservation_id, 'accept'); }, refuse(reservation_id) { return this._post(reservation_id, 'refuse'); }, _post(reservation_id, action) { return fetch(`${ReservairServiceAPI.restUrl}/reservation/${reservation_id}/${action}`, { method: 'POST', credentials: 'same-origin', headers: { 'X-WP-Nonce': ReservairServiceAPI.nonce }, }).then(r => { if (!r.ok) return r.json().then(e => { throw new Error(e.error || 'Request failed'); }); }); }, };