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

+9 -1
View File
@@ -29,7 +29,7 @@
<div v-if="uuid">
<form @submit.prevent="submit" class="flex flex-col gap-12">
<Input label="E-Mail-Adresse" v-model="emailAddress" :required="true" autocomplete="email" />
<Input label="E-Mail-Adresse" v-model="emailAddress" type="email" :required="true" autocomplete="email" />
<label class="flex gap-4 text-sm cursor-pointer">
<input v-model="acceptedTermsAndConditions" required type="checkbox" class="w-4 cursor-pointer" />
@@ -44,6 +44,10 @@
<hr />
<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>
<Button type="submit" classes="w-full" :is-pending="formSubmitIsPending">Weiter zur Lieferadresse</Button>
</form>
</div>
@@ -60,6 +64,7 @@
<script setup lang="ts">
import { trackEvent } from "~/utils/trackEvent";
import { checkoutErrorMessageFor } from "~/utils/checkoutError";
const COOKIE_CONSENT_KEY = "shop:cookie-consent";
@@ -68,6 +73,7 @@ const cart = useCart();
const emailAddress = ref("");
const acceptedTermsAndConditions = ref(false);
const formSubmitIsPending = ref(false);
const errorMessage = ref("");
const uuid = computed(() => cart.uuid.value);
@@ -120,6 +126,7 @@ async function submit() {
try {
formSubmitIsPending.value = true;
errorMessage.value = "";
// Use cart.update() to sync local state after API call
await cart.update({
@@ -138,6 +145,7 @@ async function submit() {
navigateTo("/checkout/2");
} catch (error) {
console.error("Error submitting email address", error);
errorMessage.value = checkoutErrorMessageFor(error);
} finally {
formSubmitIsPending.value = false;
}