async function confirmTicket()

in src/frontend_service/static/index.js [272:291]


async function confirmTicket(id) {
    logMessage("human", "Looks good to me.")
    const params = JSON.stringify(confirmations[id]);
    const response = await fetch('book/flight', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({ params }),
    });
    if (response.ok) {
        const text_response = await response.text();
        removeTicketChoices(id);
        logMessage("ai", "<p>Your flight has been successfully booked.</p>")
    } else {
        console.error(await response.text())
        removeTicketChoices(id);
        logMessage("ai", "Sorry, flight booking failed. 😢")
    }
}