Added shop and checkout to the CMS
Checkout is done with stripe Added reservation system
This commit is contained in:
parent
09e54033dd
commit
702d99b9ed
42 changed files with 3332 additions and 21 deletions
15
app/src/lib/stripe-client.ts
Normal file
15
app/src/lib/stripe-client.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { loadStripe as _loadStripe } from '@stripe/stripe-js';
|
||||
import { env } from '$env/dynamic/public';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
let stripePromise: ReturnType<typeof _loadStripe> | null = null;
|
||||
|
||||
export function loadStripe() {
|
||||
if (!browser) return null;
|
||||
if (!stripePromise) {
|
||||
const key = env.PUBLIC_STRIPE_PUBLISHABLE_KEY;
|
||||
if (!key) throw new Error('PUBLIC_STRIPE_PUBLISHABLE_KEY is not set');
|
||||
stripePromise = _loadStripe(key);
|
||||
}
|
||||
return stripePromise;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue