Refactor routes to use cleaner URL structure with order_id parameter
This commit is contained in:
@@ -10,12 +10,17 @@ export default class extends Controller {
|
||||
"checkoutButton",
|
||||
"form",
|
||||
];
|
||||
static values = { eventSlug: String, eventId: String };
|
||||
|
||||
static values = { targetUrl: String, eventSlug: String, eventId: String };
|
||||
|
||||
// Initialize the controller and update the cart summary
|
||||
connect() {
|
||||
console.log("TicketSelectionController connected");
|
||||
console.log("Target URL: ", this.target);
|
||||
|
||||
this.updateCartSummary();
|
||||
this.bindFormSubmission();
|
||||
|
||||
}
|
||||
|
||||
// Bind form submission to handle cart storage
|
||||
@@ -118,8 +123,9 @@ export default class extends Controller {
|
||||
await this.storeCartInSession(cartData);
|
||||
|
||||
// Redirect to event-scoped orders/new page
|
||||
const OrderNewUrl = `/events/${this.eventSlugValue}.${this.eventIdValue}/orders/new`;
|
||||
window.location.href = OrderNewUrl;
|
||||
// const orderNewUrl = `/orders/new/events/${this.eventSlugValue}.${this.eventIdValue}`;
|
||||
const orderNewUrl = `/orders/new/events/${this.eventSlugValue}.${this.eventIdValue}`;
|
||||
window.location.href = orderNewUrl;
|
||||
} catch (error) {
|
||||
console.error("Error storing cart:", error);
|
||||
alert("Une erreur est survenue. Veuillez réessayer.");
|
||||
|
||||
Reference in New Issue
Block a user