From 2d496f8f6a8fae170e0e698b56156313cc7b78fd Mon Sep 17 00:00:00 2001 From: Chika Date: Wed, 2 Nov 2022 13:42:01 +0300 Subject: [PATCH] trpc: fix query with basePath --- trpc/client.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trpc/client.ts b/trpc/client.ts index 9270270..574d56d 100644 --- a/trpc/client.ts +++ b/trpc/client.ts @@ -5,10 +5,10 @@ import type { AppRouter } from './routers'; function getBaseUrl() { if (typeof window !== 'undefined') { - return ''; + return process.env.NEXT_PUBLIC_BASE_PATH ?? ''; } - return `http://localhost:${process.env.PORT ?? 3000}`; + return `http://localhost:${process.env.PORT ?? 3000}${process.env.NEXT_PUBLIC_BASE_PATH ?? ''}`; } export const trpcClient = createTRPCNext({