Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
oFem1m committed May 24, 2024
1 parent 76adc03 commit 8195b2d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/firebase-messaging-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ firebase.initializeApp({
const messaging = firebase.messaging();

Check failure on line 22 in src/firebase-messaging-sw.js

View workflow job for this annotation

GitHub Actions / ci

'firebase' is not defined

messaging.onBackgroundMessage((payload) => {
console.log(
'[firebase-messaging-sw.js] Received background message ',
payload,
);
// Customize notification here
const notificationTitle = payload.notification.title;
const notificationOptions = {
body: payload.notification.body,
icon: './img/logo.png',
};

self.registration.showNotification(notificationTitle, notificationOptions);
self.registration
.showNotification(notificationTitle, notificationOptions)
.then();
});
2 changes: 0 additions & 2 deletions src/utils/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ function subscribe() {
})
.then((currentToken) => {
if (currentToken) {
console.log(currentToken);
sendTokenToServer(currentToken);
} else {
console.warn('Не удалось получить токен.');
Expand Down Expand Up @@ -73,7 +72,6 @@ function setTokenSentToServer(currentToken) {

if ('Notification' in window) {
onMessage(messaging, function (payload) {
console.log('Message received. ', payload);
new Notification(payload.notification.title, payload.notification);
});
}

0 comments on commit 8195b2d

Please sign in to comment.