From e6cecef60eacdb332151943b8ee36a2d2fa50afb Mon Sep 17 00:00:00 2001 From: Joseph Le Date: Thu, 2 Jul 2026 16:12:08 +1000 Subject: [PATCH] Update link --- .gitignore | 1 + public/app.js | 5 +++-- public/index.html | 6 +++++- server.js | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b95481f..1dde945 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules/ # data/*.db # data/*.db-* .env +public/config.js \ No newline at end of file diff --git a/public/app.js b/public/app.js index 9a73cf4..5e12057 100644 --- a/public/app.js +++ b/public/app.js @@ -1,3 +1,4 @@ +const PRODUCTION = window.APP_CONFIG.PRODUCTION; const $ = (sel, root = document) => root.querySelector(sel); const $$ = (sel, root = document) => [...root.querySelectorAll(sel)]; @@ -130,7 +131,7 @@ form.addEventListener('submit', async (e) => { setLoading(true); resultBox.hidden = true; try { - const res = await fetch('/api/payments', { + const res = await fetch(`${PRODUCTION ? '/quick-payment' : ''}/api/payments`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: JSON.stringify(payload), @@ -166,7 +167,7 @@ form.addEventListener('submit', async (e) => { async function loadHistory() { const list = $('#history-list'); try { - const res = await fetch('/api/payments'); + const res = await fetch(`${PRODUCTION ? '/quick-payment' : ''}/api/payments`); const data = await res.json(); const payments = data.payments || []; if (payments.length === 0) { diff --git a/public/index.html b/public/index.html index f80b60c..538c189 100644 --- a/public/index.html +++ b/public/index.html @@ -1,5 +1,6 @@ + @@ -7,6 +8,7 @@ +
@@ -108,6 +110,8 @@ + - + + \ No newline at end of file diff --git a/server.js b/server.js index 5554e82..e8c703d 100644 --- a/server.js +++ b/server.js @@ -6,6 +6,7 @@ const { createPaymentLink } = require('./payment-api'); const app = express(); const PORT = process.env.PORT || 3000; +const PRODUCTION = process.env.PRODUCTION; app.use(express.json()); app.use(express.static(path.join(__dirname, 'public')));