From b750ac511763eae97618b33e89caee678b9824b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=82=A8=EC=A0=95=EC=9A=B1?= <113816822+HelloWook@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:46:30 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20fcm=20=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/firebase-messaging-sw.js | 14 ++++++++++++++ src/App.tsx | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 public/firebase-messaging-sw.js diff --git a/public/firebase-messaging-sw.js b/public/firebase-messaging-sw.js new file mode 100644 index 00000000..91f15b4e --- /dev/null +++ b/public/firebase-messaging-sw.js @@ -0,0 +1,14 @@ +importScripts("https://www.gstatic.com/firebasejs/8.7.1/firebase-app.js"); +importScripts("https://www.gstatic.com/firebasejs/8.7.1/firebase-messaging.js"); + +firebase.initializeApp({ + apiKey: "AIzaSyBodJm9QErZvWuaOdM6Af1H82LA-8ZcmhE", + authDomain: "fcm-test-51b74.firebaseapp.com", + projectId: "fcm-test-51b74", + storageBucket: "fcm-test-51b74.firebasestorage.app", + messagingSenderId: "10805910843", + appId: "1:10805910843:web:e88131c7c1ef503822eb1e", + measurementId: "G-FXC5BWDC6G", +}); + +const messaging = firebase.messaging(); diff --git a/src/App.tsx b/src/App.tsx index 15fde6fb..6108d701 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,10 +3,11 @@ import { RouterProvider } from 'react-router-dom'; import { router } from '@/router'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; +import { usePushNotification } from './hooks/usePushNotification '; export const App = () => { const queryClient = new QueryClient(); - + usePushNotification(); return (