Spaces:
Sleeping
Sleeping
Jon Taylor
commited on
Commit
·
f7b9ff6
1
Parent(s):
0aa52a4
added window check
Browse files- frontend/app/utils.js +8 -4
frontend/app/utils.js
CHANGED
@@ -1,5 +1,9 @@
|
|
|
|
|
|
1 |
export const apiUrl =
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
1 |
+
"use client";
|
2 |
+
|
3 |
export const apiUrl =
|
4 |
+
typeof window !== "undefined"
|
5 |
+
? process.env.NEXT_PUBLIC_API_URL
|
6 |
+
: process.env.NEXT_PUBLIC_API_URL ||
|
7 |
+
`${window.location.protocol === "https:" ? "https" : "http"}://${
|
8 |
+
window.location.host
|
9 |
+
}`;
|