Spaces:
Sleeping
Sleeping
Commit ·
712f10d
1
Parent(s): dfe09a2
feat: enhance API base URL configuration for local and production environments
Browse files
script.js
CHANGED
|
@@ -6,8 +6,10 @@
|
|
| 6 |
*/
|
| 7 |
|
| 8 |
// API Configuration
|
| 9 |
-
//
|
| 10 |
-
const API_BASE_URL = window.location.
|
|
|
|
|
|
|
| 11 |
|
| 12 |
// DOM Elements
|
| 13 |
const elements = {
|
|
|
|
| 6 |
*/
|
| 7 |
|
| 8 |
// API Configuration
|
| 9 |
+
// Smart API Configuration: Use port 8000 locally, but use the current origin for remote (HF/Production)
|
| 10 |
+
const API_BASE_URL = (window.location.hostname === "127.0.0.1" || window.location.hostname === "localhost")
|
| 11 |
+
? window.location.protocol + "//" + window.location.hostname + ":8000"
|
| 12 |
+
: window.location.origin;
|
| 13 |
|
| 14 |
// DOM Elements
|
| 15 |
const elements = {
|