Moved to loading stripe dynamically to prevent it tracking without opening the donation modal
This commit is contained in:
parent
4555c9bf71
commit
1f20959940
@ -1,5 +1,4 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { loadStripe } from "@stripe/stripe-js";
|
|
||||||
import { Box, Label, Button, Flex, Radio, Text } from "theme-ui";
|
import { Box, Label, Button, Flex, Radio, Text } from "theme-ui";
|
||||||
import { useLocation, useHistory } from "react-router-dom";
|
import { useLocation, useHistory } from "react-router-dom";
|
||||||
|
|
||||||
@ -27,15 +26,17 @@ function DonationModal({ isOpen, onRequestClose }) {
|
|||||||
const [stripe, setStripe] = useState();
|
const [stripe, setStripe] = useState();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (showDonationForm) {
|
if (showDonationForm) {
|
||||||
loadStripe("pk_live_MJjzi5djj524Y7h3fL5PNh4e00a852XD51")
|
import("@stripe/stripe-js").then(({ loadStripe }) => {
|
||||||
.then((stripe) => {
|
loadStripe("pk_live_MJjzi5djj524Y7h3fL5PNh4e00a852XD51")
|
||||||
setStripe(stripe);
|
.then((stripe) => {
|
||||||
setLoading(false);
|
setStripe(stripe);
|
||||||
})
|
setLoading(false);
|
||||||
.catch((err) => {
|
})
|
||||||
setError(err.message);
|
.catch((err) => {
|
||||||
setLoading(false);
|
setError(err.message);
|
||||||
});
|
setLoading(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, [showDonationForm]);
|
}, [showDonationForm]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user