Skip to content

Commit

Permalink
Merge pull request #443 from woowacourse-teams/fix/#439
Browse files Browse the repository at this point in the history
백그라운드 알림이 undefined로 오는 문제를 수정
  • Loading branch information
jaeml06 authored Aug 22, 2024
2 parents 401c18e + e54ff74 commit 2e39f29
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frontend/public/firebase-messaging-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ const messaging = firebase.messaging();
messaging.onBackgroundMessage((payload) => {
console.log('[firebase-messaging-sw.js] 백그라운드 메시지 수신:', payload);

const notificationTitle = payload.title;
const notificationTitle = payload.notification.title;
const notificationOptions = {
body: payload.body
// icon: payload.icon
body: payload.notification.body,
data: {
click_action: payload.fcmOptions.link, // 이 필드는 밑의 클릭 이벤트 처리에 사용됨
},
};
self.registration.showNotification(notificationTitle, notificationOptions);
});

0 comments on commit 2e39f29

Please sign in to comment.