2026-06-12 11:25:57 +02:00
|
|
|
export const RsvReservationClient = {
|
2026-06-11 19:03:29 +02:00
|
|
|
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'); });
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
};
|