Skip to content

Commit f7eeca9

Browse files
authored
Merge pull request #242 from w3bdesign/development
Display error during checkout if there is any
2 parents dd684b9 + 04c7d9e commit f7eeca9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

components/Checkout/CheckoutForm.component.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const CheckoutForm = () => {
2121
const [cart, setCart] = useContext(AppContext);
2222
const [orderData, setOrderData] = useState(null);
2323
const [requestError, setRequestError] = useState(null);
24-
const [orderCompleted, setorderCompleted] = useState(false);
24+
const [orderCompleted, setorderCompleted] = useState(false);
2525

2626
// Checkout GraphQL mutation
2727
const [
@@ -74,10 +74,15 @@ const CheckoutForm = () => {
7474
{/* Order*/}
7575
<OrderDetails cart={cart} />
7676
<MobileOrderDetails cart={cart} />
77-
7877
{/*Payment Details*/}
7978
<Billing onSubmit={onSubmit} />
80-
79+
{/*Error display*/}
80+
{requestError && (
81+
<div className="h-32 text-xl text-center text-red-600">
82+
En feil har oppstått. Feilmeldingen er: <br />$
83+
{requestError.toString()}
84+
</div>
85+
)}
8186
{/* Checkout Loading*/}
8287
{checkoutLoading && (
8388
<div className="text-xl text-center">
@@ -86,7 +91,6 @@ const CheckoutForm = () => {
8691
<LoadingSpinner />
8792
</div>
8893
)}
89-
{requestError}
9094
</div>
9195
) : (
9296
<>

0 commit comments

Comments
 (0)