From b1bf94aa58fa4227c31849642bc4afb233d5ce84 Mon Sep 17 00:00:00 2001 From: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Date: Mon, 15 Jan 2024 15:21:16 +0530 Subject: [PATCH] chore: added a fallback for country code (#13171) Co-authored-by: Peer Richelsen --- .../trpc/server/routers/publicViewer/countryCode.handler.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/trpc/server/routers/publicViewer/countryCode.handler.ts b/packages/trpc/server/routers/publicViewer/countryCode.handler.ts index 181a10a1cb..723632e088 100644 --- a/packages/trpc/server/routers/publicViewer/countryCode.handler.ts +++ b/packages/trpc/server/routers/publicViewer/countryCode.handler.ts @@ -7,9 +7,8 @@ type CountryCodeOptions = { export const countryCodeHandler = async ({ ctx }: CountryCodeOptions) => { const { req } = ctx; - // const countryCode: string | string[] = - // req?.headers?.["​cf-ipcountry"] ?? req?.headers?.["x-vercel-ip-country"] ?? ""; - const countryCode: string | string[] = req?.headers?.["​cf-ipcountry"] ?? ""; + const countryCode: string | string[] = + req?.headers?.["​cf-ipcountry"] ?? req?.headers?.["x-vercel-ip-country"] ?? ""; return { countryCode: Array.isArray(countryCode) ? countryCode[0] : countryCode }; };