Spaces:
Running
Running
update
Browse files- client/src/config/api.js +5 -3
client/src/config/api.js
CHANGED
|
@@ -4,11 +4,13 @@ const isHfSpace =
|
|
| 4 |
window.location !== window.parent.location;
|
| 5 |
|
| 6 |
// Get the base API URL based on the environment
|
| 7 |
-
const API_BASE_URL = isHfSpace
|
|
|
|
|
|
|
| 8 |
|
| 9 |
export const API_URLS = {
|
| 10 |
-
leaderboards: `${API_BASE_URL}/leaderboards`,
|
| 11 |
-
health: `${API_BASE_URL}/health`,
|
| 12 |
};
|
| 13 |
|
| 14 |
// Export additional environment info
|
|
|
|
| 4 |
window.location !== window.parent.location;
|
| 5 |
|
| 6 |
// Get the base API URL based on the environment
|
| 7 |
+
const API_BASE_URL = isHfSpace
|
| 8 |
+
? `${window.location.origin}` // En production (HF Space), on utilise l'URL racine
|
| 9 |
+
: "http://localhost:3002/api"; // En développement
|
| 10 |
|
| 11 |
export const API_URLS = {
|
| 12 |
+
leaderboards: `${API_BASE_URL}/api/leaderboards`,
|
| 13 |
+
health: `${API_BASE_URL}/api/health`,
|
| 14 |
};
|
| 15 |
|
| 16 |
// Export additional environment info
|