use the baseurl for the call

This commit is contained in:
Karl 2025-07-17 16:34:17 +01:00
parent fbaf79c9ae
commit b5f1375a87

View File

@ -74,7 +74,8 @@
} }
function subscribeUser(registration) { 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(response => response.json())
.then(data => { .then(data => {
const applicationServerKey = urlB64ToUint8Array(data.public_key); const applicationServerKey = urlB64ToUint8Array(data.public_key);
@ -91,7 +92,8 @@
} }
function saveSubscription(subscription) { function saveSubscription(subscription) {
fetch('/save-subscription', { const baseUrl = '{{ config.BASE_URL }}'.replace(/\/$/, ""); // Remove trailing slash if present
fetch(`${baseUrl}/save-subscription`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',