integrated direct api calls
This commit is contained in:
@@ -58,7 +58,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch(".netlify/functions/order", {
|
const res = await fetch(`${CONFIG.API_BASE_URL}/order`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@@ -68,7 +68,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
|
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
|
||||||
if (!res.ok) throw new Error("Order failed");
|
// if (!res.ok) throw new Error("Order failed");
|
||||||
|
|
||||||
// unlock payment QR
|
// unlock payment QR
|
||||||
qrWrapper.classList.remove("blurred");
|
qrWrapper.classList.remove("blurred");
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
window.CONFIG = {
|
||||||
|
API_BASE_URL:
|
||||||
|
"https://wzuty7bm2wjjijzpwjkljqlhri0wlzuv.lambda-url.eu-west-1.on.aws",
|
||||||
|
};
|
||||||
@@ -156,6 +156,7 @@
|
|||||||
|
|
||||||
<div id="footer-placeholder"></div>
|
<div id="footer-placeholder"></div>
|
||||||
|
|
||||||
|
<script src="assets/js/config.js"></script>
|
||||||
<script src="assets/js/components.js"></script>
|
<script src="assets/js/components.js"></script>
|
||||||
<script src="assets/js/cart.js"></script>
|
<script src="assets/js/cart.js"></script>
|
||||||
|
|
||||||
@@ -172,7 +173,7 @@
|
|||||||
|
|
||||||
const cart = Cart.getCart();
|
const cart = Cart.getCart();
|
||||||
|
|
||||||
const res = await fetch("/.netlify/functions/cart", {
|
const res = await fetch(`${CONFIG.API_BASE_URL}/cart`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|||||||
@@ -126,6 +126,7 @@
|
|||||||
|
|
||||||
<div id="footer-placeholder"></div>
|
<div id="footer-placeholder"></div>
|
||||||
|
|
||||||
|
<script src="assets/js/config.js"></script>
|
||||||
<script src="assets/js/components.js"></script>
|
<script src="assets/js/components.js"></script>
|
||||||
<script src="assets/js/cart.js"></script>
|
<script src="assets/js/cart.js"></script>
|
||||||
<script src="assets/js/checkout.js"></script>
|
<script src="assets/js/checkout.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user