mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-25 14:52:20 +01:00
23 lines
614 B
TypeScript
23 lines
614 B
TypeScript
|
/**
|
||
|
* This component initializes the stripe's Elements tag with the API key
|
||
|
*/
|
||
|
|
||
|
import React from 'react';
|
||
|
import { Elements } from '@stripe/react-stripe-js';
|
||
|
import { IApplication } from '../models/application';
|
||
|
import SettingAPI from '../api/setting';
|
||
|
import { loadStripe } from "@stripe/stripe-js";
|
||
|
|
||
|
const stripePublicKey = SettingAPI.get('stripe_public_key');
|
||
|
|
||
|
export const StripeElements: React.FC = ({ children }) => {
|
||
|
const publicKey = stripePublicKey.read();
|
||
|
const stripePromise = loadStripe(publicKey.value);
|
||
|
|
||
|
return (
|
||
|
<Elements stripe={stripePromise}>
|
||
|
{children}
|
||
|
</Elements>
|
||
|
);
|
||
|
}
|