1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-11 00:52:29 +01:00

23 lines
617 B
TypeScript
Raw Normal View History

/**
* This component initializes the stripe's Elements tag with the API key
*/
import React from 'react';
import { Elements } from '@stripe/react-stripe-js';
import { loadStripe } from "@stripe/stripe-js";
2020-11-24 16:26:18 +01:00
import SettingAPI from '../api/setting';
import { SettingName } from '../models/setting';
2020-11-24 16:26:18 +01:00
const stripePublicKey = SettingAPI.get(SettingName.StripePublicKey);
export const StripeElements: React.FC = ({ children }) => {
const publicKey = stripePublicKey.read();
const stripePromise = loadStripe(publicKey.value);
return (
<Elements stripe={stripePromise}>
{children}
</Elements>
);
}