logs removed

This commit is contained in:
dimitar committed 2026-02-22 04:49:38 +01:00
1 parent 57864e00da
commit d041575600
7 files changed
+18 -101

No files matched your search

+9 -30
View File
@@ -20,8 +20,7 @@ export async function getVapidPublicKey(): Promise<string | null> {
}
const data: VapidPublicKeyResponse = await response.json();
return data.publicKey;
} catch (error) {
console.error('Error fetching VAPID public key:', error);
} catch {
return null;
}
}
@@ -30,39 +29,20 @@ export async function subscribeToPush(
subscription: PushSubscriptionData,
): Promise<boolean> {
try {
console.log('Sending subscription to server:', {
endpoint: subscription.endpoint,
hasKeys: !!subscription.keys,
});
const payload = {
endpoint: subscription.endpoint,
p256dh: subscription.keys.p256dh,
auth: subscription.keys.auth,
};
console.log('Payload:', payload);
console.log('API URL:', `${API_BASE_URL}/push/subscribe`);
const response = await fetch(`${API_BASE_URL}/push/subscribe`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
body: JSON.stringify({
endpoint: subscription.endpoint,
p256dh: subscription.keys.p256dh,
auth: subscription.keys.auth,
}),
});
console.log('Subscribe response status:', response.status);
if (!response.ok) {
const errorText = await response.text();
console.error('Subscribe failed:', errorText);
return false;
}
return true;
} catch (error) {
console.error('Error subscribing to push:', error);
return response.ok;
} catch {
return false;
}
}
@@ -79,8 +59,7 @@ export async function unsubscribeFromPush(
body: JSON.stringify({ endpoint }),
});
return response.ok;
} catch (error) {
console.error('Error unsubscribing from push:', error);
} catch {
return false;
}
}