From 9539d26ac78721c9462480288398b9c78b661417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20L=C3=B3pez?= Date: Tue, 12 Oct 2021 08:54:42 -0600 Subject: [PATCH] Fixes location in payment page (#918) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- ee/components/stripe/PaymentPage.tsx | 2 +- ee/pages/payment/[uid].tsx | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ee/components/stripe/PaymentPage.tsx b/ee/components/stripe/PaymentPage.tsx index 5beb2e23..24a4bf28 100644 --- a/ee/components/stripe/PaymentPage.tsx +++ b/ee/components/stripe/PaymentPage.tsx @@ -78,7 +78,7 @@ const PaymentPage: FC = (props) => { {props.booking.location && ( <>
Where
-
{location}
+
{props.booking.location}
)}
Price
diff --git a/ee/pages/payment/[uid].tsx b/ee/pages/payment/[uid].tsx index df293246..5666119b 100644 --- a/ee/pages/payment/[uid].tsx +++ b/ee/pages/payment/[uid].tsx @@ -1,14 +1,18 @@ import { GetServerSidePropsContext } from "next"; +import { serverSideTranslations } from "next-i18next/serverSideTranslations"; import { PaymentData } from "@ee/lib/stripe/server"; import { asStringOrThrow } from "@lib/asStringOrNull"; +import { getOrSetUserLocaleFromHeaders } from "@lib/core/i18n/i18n.utils"; import prisma from "@lib/prisma"; import { inferSSRProps } from "@lib/types/inferSSRProps"; export type PaymentPageProps = inferSSRProps; export const getServerSideProps = async (context: GetServerSidePropsContext) => { + const locale = await getOrSetUserLocaleFromHeaders(context.req); + const rawPayment = await prisma.payment.findFirst({ where: { uid: asStringOrThrow(context.query.uid), @@ -99,6 +103,8 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) => booking, payment, profile, + localeProp: locale, + ...(await serverSideTranslations(locale, ["common"])), }, }; };