trpc: fix query with basePath

This commit is contained in:
Chika 2022-11-02 13:42:01 +03:00
parent f85373689a
commit 2d496f8f6a

View File

@ -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<AppRouter>({