Skip to content

Commit 0e4d2ad

Browse files
Update react.tsx
Co-authored-by: Julius Marminge <[email protected]>
1 parent 6366f8b commit 0e4d2ad

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cli/template/extras/src/trpc/react.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,9 @@ export function TRPCReactProvider(props: { children: React.ReactNode }) {
7373

7474
function getBaseUrl() {
7575
if (typeof window !== "undefined") return window.location.origin;
76-
if (process.env.VERCEL_URL) {
77-
if (process.env.VERCEL_ENV === "production")
78-
return `https://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}`;
79-
return `https://${process.env.VERCEL_URL}`;
80-
}
76+
if (process.env.NEXT_PUBLIC_VERCEL_ENV === "production")
77+
return `https://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}`;
78+
if (process.env.NEXT_PUBLIC_VERCEL_ENV === "preview")
79+
return `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`;
8180
return `http://localhost:${process.env.PORT ?? 3000}`;
8281
}

0 commit comments

Comments
 (0)