Skip to content

Commit

Permalink
๐Ÿ› ํ‘ธ์‹œ ์•Œ๋ฆผ ์„ค์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
abcxj123 committed Jul 9, 2024
1 parent 8274a53 commit f4dae48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// Register a service worker hosted at the root of the
// site using the default scope.
navigator.serviceWorker
.register("./sw.js")
.register("/sw.js")
.then((registration) => {
console.log("Service worker registration succeeded:", registration);
})
Expand Down
11 changes: 7 additions & 4 deletions src/firebaseConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ if (!firebase.apps.length) {
firebase.app(); // ์ด๋ฏธ ์ดˆ๊ธฐํ™”๋˜์—ˆ๋‹ค๋ฉด, ์ดˆ๊ธฐํ™” ๋œ ๊ฒƒ์„ ์‚ฌ์šฉํ•จ
}

// navigator.serviceWorker.register("/firebase-messaging-sw.js", {
// scope: "/firebase-cloud-messaging-push-scope",
// });
navigator.serviceWorker.register("/firebase-messaging-sw.js", {
scope: "/firebase-cloud-messaging-push-scope",
});

export function requestPermission() {
if (!firebase.messaging.isSupported()) return null;
if (!firebase.messaging.isSupported()) {
alert("ํ‘ธ์‹œ ์•Œ๋ฆผ์„ ์ง€์›ํ•˜์ง€ ์•Š๋Š” ๊ธฐ์ข…์ž…๋‹ˆ๋‹ค.");
return null;
}
const messaging = firebase.messaging();
return Notification.requestPermission().then((permission) => {
if (permission === "granted") {
Expand Down

0 comments on commit f4dae48

Please sign in to comment.