notification
This commit is contained in:
parent
75f210df5f
commit
9e3348d9b6
@ -127,13 +127,29 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function saveSubscription(subscription) {
|
function saveSubscription(subscription) {
|
||||||
|
console.log('Attempting to save subscription...');
|
||||||
fetch('/save-subscription', {
|
fetch('/save-subscription', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json'
|
||||||
'Authorization': 'Basic {{ session.auth_credentials }}'
|
|
||||||
},
|
},
|
||||||
body: JSON.stringify(subscription)
|
body: JSON.stringify(subscription)
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
console.log('Subscription saved successfully.');
|
||||||
|
return response.json();
|
||||||
|
} else {
|
||||||
|
console.error('Failed to save subscription. Status:', response.status);
|
||||||
|
response.text().then(text => console.error('Server response:', text));
|
||||||
|
throw new Error('Failed to save subscription.');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
console.log('Server response on save:', data);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error('Error during saveSubscription fetch:', err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user