1294a177ae
This work was done with Claude. Added bundling of CSS & JS with WebPack. This also means minimization. --------- Co-authored-by: Martin Slachta <martin.slachta@outlook.com> Reviewed-on: #1
20 lines
631 B
JavaScript
20 lines
631 B
JavaScript
export 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'); });
|
|
});
|
|
},
|
|
};
|