Skip to content

Commit

Permalink
Use Oxygen.env for recaptcha key
Browse files Browse the repository at this point in the history
  • Loading branch information
futurGH committed Dec 21, 2023
1 parent cfdb228 commit 8659945
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/lib/ReCaptcha.client.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { GoogleReCaptchaProvider } from "react-google-recaptcha-v3";
import type { ReactNode } from "react";

const env: Record<string, string> = typeof Oxygen !== "undefined" && "env" in Oxygen ? Oxygen.env : import.meta.env;

export function ReCaptcha({ children }: { children: ReactNode }) {
return (
<GoogleReCaptchaProvider reCaptchaKey={import.meta.env.PUBLIC_RECAPTCHA_SITE_KEY}>
{children}
</GoogleReCaptchaProvider>
);
return <GoogleReCaptchaProvider reCaptchaKey={env.PUBLIC_RECAPTCHA_SITE_KEY}>{children}</GoogleReCaptchaProvider>;
}

0 comments on commit 8659945

Please sign in to comment.