Skip to content

Commit

Permalink
Merge pull request #112 from Hanaemong/#111
Browse files Browse the repository at this point in the history
[chore] Service worker 추가
  • Loading branch information
abcxj123 authored Jul 9, 2024
2 parents 231e7b4 + d53035e commit 8274a53
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
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
1 change: 1 addition & 0 deletions src/pages/auth/Join.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const Join = () => {
console.log(response);
if (response.data) {
setIsActive(false);
setCookie("phone", phoneNumRef.current!.value);
} else if (!response.data) {
setIsActive(true);
}
Expand Down
14 changes: 14 additions & 0 deletions sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// install event
self.addEventListener("install", (e) => {
console.log("[Service Worker] installed", e);
});

// activate event
self.addEventListener("activate", (e) => {
console.log("[Service Worker] actived", e);
});

// fetch event
self.addEventListener("fetch", (e) => {
console.log("[Service Worker] fetched resource " + e.request.url);
});

0 comments on commit 8274a53

Please sign in to comment.