Skip to content

Commit

Permalink
Merge pull request #242 from w3bdesign/development
Browse files Browse the repository at this point in the history
Display error during checkout if there is any
  • Loading branch information
w3bdesign authored Sep 14, 2020
2 parents dd684b9 + 04c7d9e commit f7eeca9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions components/Checkout/CheckoutForm.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const CheckoutForm = () => {
const [cart, setCart] = useContext(AppContext);
const [orderData, setOrderData] = useState(null);
const [requestError, setRequestError] = useState(null);
const [orderCompleted, setorderCompleted] = useState(false);
const [orderCompleted, setorderCompleted] = useState(false);

// Checkout GraphQL mutation
const [
Expand Down Expand Up @@ -74,10 +74,15 @@ const CheckoutForm = () => {
{/* Order*/}
<OrderDetails cart={cart} />
<MobileOrderDetails cart={cart} />

{/*Payment Details*/}
<Billing onSubmit={onSubmit} />

{/*Error display*/}
{requestError && (
<div className="h-32 text-xl text-center text-red-600">
En feil har oppstått. Feilmeldingen er: <br />$
{requestError.toString()}
</div>
)}
{/* Checkout Loading*/}
{checkoutLoading && (
<div className="text-xl text-center">
Expand All @@ -86,7 +91,6 @@ const CheckoutForm = () => {
<LoadingSpinner />
</div>
)}
{requestError}
</div>
) : (
<>
Expand Down

1 comment on commit f7eeca9

@vercel
Copy link

@vercel vercel bot commented on f7eeca9 Sep 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.