confirm-slot
Description
Fires when confirming the booking of a slot
Usage
"confirm-slot": ({
slot:{
id:string|number,
time: [ number, number ]
},
data:{
[key]: any
},
confirm:{
promise:Promise,
done: (value:any) => void,
error: (error: Error) => void
}
}) => void;
Parameters
The callback of the confirm-slot event can take an object with the following parameters:
slot
- (required) an object with the next slot parameters:id
- (required) the ID of a card for which the booking of a slot is confirmedtime
- (required) an array with the slot start time in milliseconds and the slot duration in minutes
data
- (required) an abject with the booking screen fields with the following parameters for each field:key
- (required) the form field ID (from theformShape
). By default, three fields are added: name, email, description
confirm
- (required) an object with the next parameters:promise
- (required) a promise that represents the confirmation status. This is a JavaScript Promise object that represents the asynchronous operation of confirming the slot booking. The promise will be resolved or rejected based on the outcome of the booking process. You can attach.then
and.catch
handlers to this promise to handle the success or failure of the booking.done
- (required) a callback function that should be called when booking is successfully confirmed. Calling this function will resolve the promise, indicating that the booking was successful. You can call this function after receiving a positive response from the server.error
- (required) a callback function that should be called when booking fails. Calling this function will reject the promise, indicating that the booking was unsuccessful. You can call this function after receiving a negative response from the server.
Example
// create Booking
const booking = new booking.Booking("#root", {
data,
// other configuration parameters
});
booking.api.on("confirm-slot", (obj) => {
console.log("The slot id for which booking was confirmed:", obj.id);
});
Related articles: setConfirmHandler
method