diff --git a/assets/js/checkout.js b/assets/js/checkout.js index c5d13c5..69004c0 100644 --- a/assets/js/checkout.js +++ b/assets/js/checkout.js @@ -58,7 +58,7 @@ document.addEventListener("DOMContentLoaded", () => { }; try { - const res = await fetch(".netlify/functions/order", { + const res = await fetch(`${CONFIG.API_BASE_URL}/order`, { method: "POST", headers: { "Content-Type": "application/json", @@ -68,7 +68,7 @@ document.addEventListener("DOMContentLoaded", () => { console.log(res); - if (!res.ok) throw new Error("Order failed"); + // if (!res.ok) throw new Error("Order failed"); // unlock payment QR qrWrapper.classList.remove("blurred"); diff --git a/assets/js/config.js b/assets/js/config.js new file mode 100644 index 0000000..97d8947 --- /dev/null +++ b/assets/js/config.js @@ -0,0 +1,4 @@ +window.CONFIG = { + API_BASE_URL: + "https://wzuty7bm2wjjijzpwjkljqlhri0wlzuv.lambda-url.eu-west-1.on.aws", +}; diff --git a/cart.html b/cart.html index e50975f..1122c83 100644 --- a/cart.html +++ b/cart.html @@ -156,6 +156,7 @@
+ @@ -172,7 +173,7 @@ const cart = Cart.getCart(); - const res = await fetch("/.netlify/functions/cart", { + const res = await fetch(`${CONFIG.API_BASE_URL}/cart`, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/checkout.html b/checkout.html index 3e23903..31f05f9 100644 --- a/checkout.html +++ b/checkout.html @@ -126,6 +126,7 @@ +