diff --git a/templates/base.html b/templates/base.html index 12db588..aed1bd0 100644 --- a/templates/base.html +++ b/templates/base.html @@ -74,7 +74,8 @@ } function subscribeUser(registration) { - fetch('http://localhost:3001/vapid-public-key') + const baseUrl = '{{ config.BASE_URL }}'.replace(/\/$/, ""); // Remove trailing slash if present + fetch(`${baseUrl}/vapid-public-key`) .then(response => response.json()) .then(data => { const applicationServerKey = urlB64ToUint8Array(data.public_key); @@ -91,7 +92,8 @@ } function saveSubscription(subscription) { - fetch('/save-subscription', { + const baseUrl = '{{ config.BASE_URL }}'.replace(/\/$/, ""); // Remove trailing slash if present + fetch(`${baseUrl}/save-subscription`, { method: 'POST', headers: { 'Content-Type': 'application/json',