From 6eca3a5a72fb9e9497c227f7ee5c4300047bd06d Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 12 Jun 2026 12:44:43 +0200 Subject: [PATCH] Widget: Fix 429 handling in Vue3 widget --- .../static/pretixpresale/widget/src/sharedStore.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/pretix/static/pretixpresale/widget/src/sharedStore.ts b/src/pretix/static/pretixpresale/widget/src/sharedStore.ts index 1c44a9eb40..96700135f5 100644 --- a/src/pretix/static/pretixpresale/widget/src/sharedStore.ts +++ b/src/pretix/static/pretixpresale/widget/src/sharedStore.ts @@ -441,6 +441,7 @@ export function createWidgetStore (config: { this.overlay.frameLoading = false this.overlay.errorUrlAfter = this.newTabTarget this.overlay.errorUrlAfterNewTab = true + return } else if (e.status === 405) { // Likely a redirect! this.targetUrl = e.responseUrl.substring(0, e.responseUrl.indexOf('/cart/add') - 18) @@ -460,11 +461,18 @@ export function createWidgetStore (config: { this.overlay.frameLoading = true const data = await createCart(url) this.setCartId(data.cart_id) + return true } catch (e) { - if (e instanceof ApiError && (e.status === 200 || (e.status >= 400 && e.status < 500))) { + if (e instanceof ApiError && e.status === 429) { + this.overlay.errorMessage = STRINGS.cart_error_429 + this.overlay.frameLoading = false + this.overlay.errorUrlAfter = this.newTabTarget + this.overlay.errorUrlAfterNewTab = true + } else if (e instanceof ApiError && (e.status === 200 || (e.status >= 400 && e.status < 500))) { this.overlay.errorMessage = STRINGS.cart_error this.overlay.frameLoading = false } + return false } }, redeem (voucherCode: string, event?: Event) { @@ -484,7 +492,7 @@ export function createWidgetStore (config: { async resume () { if (!this.cartId && this.keepCart) { // create an empty cart whose id we can persist - await this.createCart() + if (!await this.createCart()) return } let redirectUrl = `${this.targetUrl}w/${globalWidgetId}/` if (this.subevent && this.isButton && this.items.length === 0) {