Checkout: forward only the checkout fields, show clear errors, fix the contact form (#16)
build / test (push) Successful in 10s
build / build (push) Skipped

Co-authored-by: Michael Czechowski <mail@librete.ch>
This commit was merged in pull request #16.
This commit is contained in:
libretech authored and Michael Czechowski committed 2026-10-15 10:31:57 +02:00
1 parent d5dd109c63
commit d46bc9380e
29 files changed
+1108 -71

No files matched your search

+8
View File
@@ -97,6 +97,10 @@
<hr class="my-12" />
<div v-if="errorMessage" class="p-4 lg:p-8 text-center mx-auto rounded-md bg-rose-100" role="alert" data-e2e="checkout-error">
<span class="text-rose-800">{{ errorMessage }}</span>
</div>
<div class="mt-12">
<Button classes="w-full" type="submit" :is-pending="formSubmitIsPending">Weiter zur Zahlung</Button>
</div>
@@ -110,6 +114,7 @@
import type { Address, StructuredAddress } from "~/types";
import { trackEvent } from "~/utils/trackEvent";
import { numberFormatter } from "~/utils/numberFormatter";
import { checkoutErrorMessageFor } from "~/utils/checkoutError";
const cart = useCart();
const shopApi = useShopApi();
@@ -134,6 +139,7 @@ const displayState = computed(() => {
});
const showOptionalDeliveryAddress = ref(false);
const formSubmitIsPending = ref(false);
const errorMessage = ref("");
const deliveryMethods = ref<any[]>([]);
const selectedDeliveryMethod = ref<number | null>(null);
@@ -243,6 +249,7 @@ async function submit() {
try {
formSubmitIsPending.value = true;
errorMessage.value = "";
// Use cart.update() to sync local state after API call
await cart.update({
@@ -262,6 +269,7 @@ async function submit() {
navigateTo("/checkout/3");
} catch (error) {
console.error("Error submitting address form:", error);
errorMessage.value = checkoutErrorMessageFor(error);
} finally {
formSubmitIsPending.value = false;
}