feat: Log push notification error (#12543)

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
Shivam Mishra
2025-09-29 15:19:45 +05:30
committed by GitHub
parent 6c6aaf573c
commit 406a470c81

View File

@@ -68,13 +68,17 @@ export const registerSubscription = (onSuccess = () => {}) => {
.then(() => { .then(() => {
onSuccess(); onSuccess();
}) })
.catch(() => { .catch(error => {
// eslint-disable-next-line no-console
console.error('Push subscription registration failed:', error);
useAlert('This browser does not support desktop notification'); useAlert('This browser does not support desktop notification');
}); });
}; };
export const requestPushPermissions = ({ onSuccess }) => { export const requestPushPermissions = ({ onSuccess }) => {
if (!('Notification' in window)) { if (!('Notification' in window)) {
// eslint-disable-next-line no-console
console.warn('Notification is not supported');
useAlert('This browser does not support desktop notification'); useAlert('This browser does not support desktop notification');
} else if (Notification.permission === 'granted') { } else if (Notification.permission === 'granted') {
registerSubscription(onSuccess); registerSubscription(onSuccess);