Skip to content

Commit

Permalink
chore(develop): onMessage 주석 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
Doyu-Lee committed Jan 6, 2024
1 parent 1b54644 commit a8dcc4e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
44 changes: 22 additions & 22 deletions app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,28 @@ import { onMessageListener } from "./firebase/firebase";
export default {
mounted() {
// 앱 사용 중 메시지 수신
onMessageListener()
.then((payload) => {
const sendMessage = (payload) => {
const notificationTitle = payload.notification.title;
const notificationOptions = {
body: payload.notification.body,
icon: payload.notification.image,
};
const notif = new Notification(
notificationTitle,
notificationOptions,
);
notif.onclick = () => {
const router = useRouter();
router.push("/home");
console.log("Notification clicked");
};
// console.log(notif);
};
sendMessage(payload);
})
.catch((err) => console.log(err));
// onMessageListener()
// .then((payload) => {
// const sendMessage = (payload) => {
// const notificationTitle = payload.notification.title;
// const notificationOptions = {
// body: payload.notification.body,
// icon: payload.notification.image,
// };
// const notif = new Notification(
// notificationTitle,
// notificationOptions,
// );
// notif.onclick = () => {
// const router = useRouter();
// router.push("/home");
// console.log("Notification clicked");
// };
// // console.log(notif);
// };
// sendMessage(payload);
// })
// .catch((err) => console.log(err));
},
};
</script>
28 changes: 14 additions & 14 deletions registerServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ export function SW() {

if (process.env.NODE_ENV === "production") {
// 메시지 수신 서비스 워커
// register("/firebase-messaging-sw.js", {
// ready() {},
// registered() {},
// cached() {},
// updatefound() {},
// updated() {},
// offline() {},
// error(error) {
// console.error(
// "Error during service worker registration:",
// error,
// );
// },
// });
register("/firebase-messaging-sw.js", {
ready() {},
registered() {},
cached() {},
updatefound() {},
updated() {},
offline() {},
error(error) {
console.error(
"Error during service worker registration:",
error,
);
},
});

// console.log(navigator);
register(`/service-worker.js`, {
Expand Down

0 comments on commit a8dcc4e

Please sign in to comment.