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 @@ +