async onSubmit()

in client/src/pages/checkout.js [73:94]


  async onSubmit(form) {
    // Only process when form is filled out and there are items in cart
    if (form && this.cart?.length) {
      let items = getCartPayload(this.cart);
      let response = await checkout({
        customer: {
          email: form.get('email'),
        },
        payment: {
          method: form.get('type'),
        },
        items,
      });

      if (response?.errors) {
        this.setCheckoutErrors(response.errors);
      } else {
        this.clearCart();
        this.toggleSuccessDialog();
      }
    }
  }