fixed event join token handling in the event admin. created new seeders with new tenants and package purchases. added new playwright test scenarios.
This commit is contained in:
21
resources/js/utils/stripe.ts
Normal file
21
resources/js/utils/stripe.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { Stripe } from '@stripe/stripe-js';
|
||||
|
||||
const stripePromiseCache = new Map<string, Promise<Stripe | null>>();
|
||||
|
||||
export async function getStripe(publishableKey?: string): Promise<Stripe | null> {
|
||||
if (!publishableKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!stripePromiseCache.has(publishableKey)) {
|
||||
const promise = import('@stripe/stripe-js').then(({ loadStripe }) => loadStripe(publishableKey));
|
||||
stripePromiseCache.set(publishableKey, promise);
|
||||
}
|
||||
|
||||
return stripePromiseCache.get(publishableKey) ?? null;
|
||||
}
|
||||
|
||||
export function clearStripeCache(): void {
|
||||
stripePromiseCache.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user