From b69f1abd9f54c8071eb6b210199945c0ba56bcaa Mon Sep 17 00:00:00 2001 From: jnkeniaem Date: Thu, 31 Oct 2024 18:12:33 +0900 Subject: [PATCH] =?UTF-8?q?[FE]=20FIX:=20await=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EB=A7=90=EA=B3=A0=20then=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=ED=95=B4=20=ED=94=84=EB=A1=9C=EB=AF=B8=EC=8A=A4=20=ED=9B=84?= =?UTF-8?q?=EC=86=8D=20=EC=B2=98=EB=A6=AC=20#1680?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Cabinet/firebase/firebase-messaging-sw.ts | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/frontend/src/Cabinet/firebase/firebase-messaging-sw.ts b/frontend/src/Cabinet/firebase/firebase-messaging-sw.ts index 2c91a2dc5..2eb3473ea 100644 --- a/frontend/src/Cabinet/firebase/firebase-messaging-sw.ts +++ b/frontend/src/Cabinet/firebase/firebase-messaging-sw.ts @@ -20,15 +20,19 @@ export const firebaseConfig = { }; const app = initializeApp(firebaseConfig); -const isApiSupported = await isSupported(); // NOTE : 사용자 브라우저가 푸시 알림 기능을 지원하는지 확인 let messaging: null | Messaging = null; -if ( - typeof window !== "undefined" && - typeof window.navigator !== "undefined" && - isApiSupported -) { - messaging = getMessaging(app); -} +let isApiSupported = false; +isSupported().then((result) => { + isApiSupported = result; + if ( + typeof window !== "undefined" && + typeof window.navigator !== "undefined" && + isApiSupported + ) { + messaging = getMessaging(app); + } +}); // NOTE : 사용자 브라우저가 푸시 알림 기능을 지원하는지 확인 + const unsupportedMsg = `사용 중인 환경에서는 푸시 알림 기능이 지원되지 않습니다. 데스크탑 이용을 권장드립니다.`;