From f999c21d7a249f49b38614197f2458c5e0979940 Mon Sep 17 00:00:00 2001 From: Bryan Date: Tue, 10 Dec 2024 23:00:22 -0800 Subject: [PATCH] Fix firebase/app-check import --- src/components/Applause/index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/Applause/index.js b/src/components/Applause/index.js index 0b9fb94eb..43b233717 100644 --- a/src/components/Applause/index.js +++ b/src/components/Applause/index.js @@ -11,10 +11,10 @@ import { increment, } from "firebase/firestore"; import { initializeApp } from "firebase/app"; -const { +import { initializeAppCheck, ReCaptchaEnterpriseProvider, -} = require("firebase/app-check"); +} from "firebase/app-check"; import { useLocation } from "@docusaurus/router"; import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment"; @@ -31,6 +31,8 @@ function ApplauseButton() { siteConfig: { customFields }, } = useDocusaurusContext(); + console.log(customFields.recaptchaApiKey); + const firebaseConfig = { apiKey: customFields.firebaseApiKey, projectId: "pan-dev-f1b58", @@ -48,10 +50,10 @@ function ApplauseButton() { if (customFields.recaptchaApiKey && ExecutionEnvironment.canUseDOM) { app = initializeApp(firebaseConfig); - // appCheck = initializeAppCheck(app, { - // provider: new ReCaptchaEnterpriseProvider(customFields.recaptchaApiKey), - // isTokenAutoRefreshEnabled: true, - // }); + appCheck = initializeAppCheck(app, { + provider: new ReCaptchaEnterpriseProvider(customFields.recaptchaApiKey), + isTokenAutoRefreshEnabled: true, + }); db = getFirestore(app); docRef = doc(db, COLLECTION_ID, docId); }