From 1473adedd7603a51c5470d09a0045ab486145ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=BChnlein?= Date: Sat, 17 Feb 2024 15:42:49 +0100 Subject: [PATCH] fix: use 127.0.0.1 instead of localhost? --- app/src/lib/utils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/lib/utils.ts b/app/src/lib/utils.ts index c903d9d..9e0be58 100644 --- a/app/src/lib/utils.ts +++ b/app/src/lib/utils.ts @@ -6,7 +6,11 @@ export function cn(...inputs: ClassValue[]) { } export function getHost(): string { - return process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:3000"; + // this is needed because we use the api for ssr to. This is not really a good solution but works for now + // See https://github.com/vercel/next.js/discussions/48793 for the "correct" way + const isServer = typeof window === "undefined"; + const host = isServer ? "http://127.0.0.1:3000" : ""; + return host; } export function hexToCssHsl(hex: string): string {