From 8c8293828ce2193479bd3975a438962c21de4a72 Mon Sep 17 00:00:00 2001 From: Ratchet7x5 <36789694+Ratchet7x5@users.noreply.github.com> Date: Thu, 12 Dec 2024 18:51:09 +1300 Subject: [PATCH] stripe attempt #2: add missing await before loadStripe() call --- web/Dockerfile.auis | 1 + web/src/screens/CheckoutScreen.tsx | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/web/Dockerfile.auis b/web/Dockerfile.auis index 6d350af..1c67b25 100644 --- a/web/Dockerfile.auis +++ b/web/Dockerfile.auis @@ -33,6 +33,7 @@ ENV VITE_API_URL="https://auis-api.fly.dev" ENV VITE_STRAPI_URL="https://auis-strapi.fly.dev" ENV VITE_APP_URL="https://auis.fly.dev" ENV VITE_APP_NAME="AUIS" +ENV VITE_STRIPE_PUBLISHABLE_KEY=pk_test_51PPclyP464csY2UpQPZ4cpWlyupAwPXfvWZRIG0zy9BhlYE8GmR4LYEytjFKOjMS6o5oXF5I0QMB8RWcc0TqsNxC00Nz3UAH14 # Mount secrets into Dockerfile and set environment variables RUN yarn run build diff --git a/web/src/screens/CheckoutScreen.tsx b/web/src/screens/CheckoutScreen.tsx index 7c2581c..24eca01 100644 --- a/web/src/screens/CheckoutScreen.tsx +++ b/web/src/screens/CheckoutScreen.tsx @@ -12,8 +12,9 @@ const STRIPE_PUBLISHABLE_KEY = import.meta.env.VITE_STRIPE_PUBLISHABLE_KEY; // Make sure to call `loadStripe` outside of a component’s render to avoid // recreating the `Stripe` object on every render. -const stripePromise = loadStripe(`${STRIPE_PUBLISHABLE_KEY}`); +const stripePromise = await loadStripe(`${STRIPE_PUBLISHABLE_KEY}`); let bodyData: { priceId: string; userTicketId: number }; + export default function CheckoutScreen() { const location = useLocation(); // ensure data required for checkout is here