Design hotfixes and improvements.
This commit is contained in:
@@ -35,7 +35,7 @@ export function pushSupported() {
|
||||
}
|
||||
|
||||
export async function getVapidPublicKey() {
|
||||
const res = await fetch('/api/notifications/vapid-public-key');
|
||||
const res = await fetch('/api/notifications/vapid-public-key', { credentials: 'include' });
|
||||
if (!res.ok) {
|
||||
const message = res.status === 503
|
||||
? 'Las notificaciones push no están configuradas en el servidor'
|
||||
@@ -88,6 +88,7 @@ export async function subscribeToPush(medicineNregistro, medicineName, pharmacyI
|
||||
const subscription = await getOrCreateSubscription();
|
||||
const res = await fetch('/api/notifications/subscribe', {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
medicine_nregistro: medicineNregistro,
|
||||
@@ -115,6 +116,7 @@ export async function unsubscribeFromPush(medicineNregistro, pharmacyId = null)
|
||||
if (endpoint) {
|
||||
await fetch('/api/notifications/unsubscribe', {
|
||||
method: 'DELETE',
|
||||
credentials: 'include',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
medicine_nregistro: medicineNregistro,
|
||||
|
||||
Reference in New Issue
Block a user