Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Origin fallback (#136)

Bill Yang4f5eb6f36d5a
diff --git a/client/src/lib/const.ts b/client/src/lib/const.ts
index fa28ab75f..584001744 100644
--- a/client/src/lib/const.ts
+++ b/client/src/lib/const.ts
@@ -1,6 +1,8 @@
export const BACKEND_URL =
process.env.NEXT_PUBLIC_BACKEND_URL === "http://localhost:3001"
? "http://localhost:3001"
- : `${process.env.NEXT_PUBLIC_BACKEND_URL}/api`;
+ : `${
+ process.env.NEXT_PUBLIC_BACKEND_URL || globalThis.location.origin
+ }/api`;
export const IS_CLOUD = process.env.NEXT_PUBLIC_CLOUD === "true";
export const IS_DEMO = process.env.NEXT_PUBLIC_DEMO === "true";