Skip to content

Commit

Permalink
Merge pull request #116 from Ureca-Dangdang-salon/develop
Browse files Browse the repository at this point in the history
알림 테스트 배포
  • Loading branch information
skang9810 authored Dec 11, 2024
2 parents 507ddb2 + 2ad18ac commit 65f814a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions public/firebase-messaging-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ firebase.initializeApp(firebaseConfig);

const messaging = firebase.messaging();

messaging.onBackgroundMessage((payload) => {
console.log('Background message received:', payload);
if (!self.firebaseMessagingInitialized) {
messaging.onBackgroundMessage((payload) => {
console.log('Background message received:', payload);

const notificationTitle = payload.notification.title || 'Default Title';
const notificationOptions = {
body: payload.notification.body || 'Default Body',
icon: payload.notification.icon || '/default-icon.png',
};
const notificationTitle = payload.notification.title || 'Default Title';
const notificationOptions = {
body: payload.notification.body || 'Default Body',
icon: payload.notification.icon || '/default-icon.png',
};

self.registration.showNotification(notificationTitle, notificationOptions);
});
self.registration.showNotification(notificationTitle, notificationOptions);
});
}

0 comments on commit 65f814a

Please sign in to comment.