fix: working copy, caching ASP, notworking orders though

This commit is contained in:
Didier Slof 2023-02-03 09:05:29 +01:00
parent dc5d204cfc
commit 390ad23e03
Signed by: didier
GPG key ID: 01E71F18AA4398E5
32 changed files with 246 additions and 194 deletions

View file

@ -62,7 +62,7 @@
}
);
window.freq.set('seat-chooser', sc);
window.sc = sc;
})();
let total = 0;
@ -84,13 +84,14 @@ document.querySelector('button#order-button').addEventListener('click', (e) => {
window.sc.selectedSeats.forEach(seat => {
seats.push({
seat: seat.id,
ticket: seat.ticket.id
price: seat.ticket.id,
});
});
fetch(`/api/order`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + document.querySelector('#order-button').getAttribute('data-token') || ''
},
body: JSON.stringify({
showing: sc.showingId,
@ -98,7 +99,8 @@ document.querySelector('button#order-button').addEventListener('click', (e) => {
})
}).then(res => {
if (res.ok) {
window.location = '/order/complete';
// window.location = '/order/complete';
console.log('Order placed');
} else {
alert('Error placing order');
}