From eaefe1f2ca140ca18f628c8feb711c5af8527798 Mon Sep 17 00:00:00 2001 From: indykoning <15870933+indykoning@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:19:09 +0200 Subject: [PATCH] Correct error message when placing an order fails (#599) --- resources/js/components/Checkout/Checkout.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/js/components/Checkout/Checkout.vue b/resources/js/components/Checkout/Checkout.vue index 376cd8476..5f5997877 100644 --- a/resources/js/components/Checkout/Checkout.vue +++ b/resources/js/components/Checkout/Checkout.vue @@ -3,6 +3,7 @@ import InteractWithUser from './../User/mixins/InteractWithUser' import { useEventListener, useLocalStorage } from '@vueuse/core' import useMask from '../../stores/useMask' import { cart, hasOnlyVirtualItems, virtualItems, linkUserToCart } from '../../stores/useCart' +import { FetchError } from '../../fetch' export default { mixins: [InteractWithUser], @@ -242,7 +243,10 @@ export default { return true } catch (error) { - Notify(error.response.data.message, 'error', error.response.data?.parameters) + if (FetchError.prototype.isPrototypeOf(error)) { + const response = await error.response.json() + Notify(response?.message, 'error', response?.parameters) + } return false } },