Fixes location in payment page (#918)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Omar López 2021-10-12 08:54:42 -06:00 committed by GitHub
parent c94231f777
commit 9539d26ac7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -78,7 +78,7 @@ const PaymentPage: FC<PaymentPageProps> = (props) => {
{props.booking.location && ( {props.booking.location && (
<> <>
<div className="font-medium">Where</div> <div className="font-medium">Where</div>
<div className="col-span-2">{location}</div> <div className="mb-6 col-span-2">{props.booking.location}</div>
</> </>
)} )}
<div className="font-medium">Price</div> <div className="font-medium">Price</div>

View file

@ -1,14 +1,18 @@
import { GetServerSidePropsContext } from "next"; import { GetServerSidePropsContext } from "next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { PaymentData } from "@ee/lib/stripe/server"; import { PaymentData } from "@ee/lib/stripe/server";
import { asStringOrThrow } from "@lib/asStringOrNull"; import { asStringOrThrow } from "@lib/asStringOrNull";
import { getOrSetUserLocaleFromHeaders } from "@lib/core/i18n/i18n.utils";
import prisma from "@lib/prisma"; import prisma from "@lib/prisma";
import { inferSSRProps } from "@lib/types/inferSSRProps"; import { inferSSRProps } from "@lib/types/inferSSRProps";
export type PaymentPageProps = inferSSRProps<typeof getServerSideProps>; export type PaymentPageProps = inferSSRProps<typeof getServerSideProps>;
export const getServerSideProps = async (context: GetServerSidePropsContext) => { export const getServerSideProps = async (context: GetServerSidePropsContext) => {
const locale = await getOrSetUserLocaleFromHeaders(context.req);
const rawPayment = await prisma.payment.findFirst({ const rawPayment = await prisma.payment.findFirst({
where: { where: {
uid: asStringOrThrow(context.query.uid), uid: asStringOrThrow(context.query.uid),
@ -99,6 +103,8 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
booking, booking,
payment, payment,
profile, profile,
localeProp: locale,
...(await serverSideTranslations(locale, ["common"])),
}, },
}; };
}; };