Skip to content

Commit

Permalink
re-enable app check
Browse files Browse the repository at this point in the history
  • Loading branch information
sserrata committed Dec 11, 2024
1 parent 8cb3ede commit cbfb6cf
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/components/Applause/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect, useRef, useMemo } from "react";
import React, { useState, useEffect, useRef } from "react";
import clsx from "clsx";
import HandsOutline from "./assets/hands-outline.svg";
import Hands from "./assets/hands.svg";
Expand All @@ -10,11 +10,11 @@ import {
getDoc,
increment,
} from "firebase/firestore";
import { initializeApp } from "firebase/app";
const {
import { initializeApp, getApp, getApps } from "firebase/app";
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";
Expand Down Expand Up @@ -47,11 +47,15 @@ function ApplauseButton() {
let appCheck;

if (customFields.recaptchaApiKey && ExecutionEnvironment.canUseDOM) {
app = initializeApp(firebaseConfig);
// appCheck = initializeAppCheck(app, {
// provider: new ReCaptchaEnterpriseProvider(customFields.recaptchaApiKey),
// isTokenAutoRefreshEnabled: true,
// });
if (getApps().length === 0) {
app = initializeApp(firebaseConfig);
} else {
app = getApp();
}
appCheck = initializeAppCheck(app, {
provider: new ReCaptchaEnterpriseProvider(customFields.recaptchaApiKey),
isTokenAutoRefreshEnabled: true,
});
db = getFirestore(app);
docRef = doc(db, COLLECTION_ID, docId);
}
Expand Down

0 comments on commit cbfb6cf

Please sign in to comment.