-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply patch to react app to manage api prefix dynamically.
- Loading branch information
1 parent
2827e8f
commit 9fc064c
Showing
2 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
From 5b5d1f65e427540a819debcabd8f038be74f1f3e Mon Sep 17 00:00:00 2001 | ||
From: Botis <[email protected]> | ||
Date: Fri, 10 Jan 2025 17:15:03 +0100 | ||
Subject: [PATCH] fix: api url not correctly built, empty NEXT_PUBLIC_API_URL | ||
or REACT_APP_API_URL was taken in account | ||
|
||
--- | ||
node_modules/@elastic-suite/gally-admin-shared/src/constants/api.ts | 11 ++++++++--- | ||
1 file changed, 8 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/node_modules/@elastic-suite/gally-admin-shared/src/constants/api.ts b/node_modules/@elastic-suite/gally-admin-shared/src/constants/api.ts | ||
index a1ac2a1e..425a7bb2 100644 | ||
--- a/node_modules/@elastic-suite/gally-admin-shared/src/constants/api.ts | ||
+++ b/node_modules/@elastic-suite/gally-admin-shared/src/constants/api.ts | ||
@@ -1,9 +1,14 @@ | ||
let url = | ||
process.env.NODE_ENV === 'test' | ||
? 'http://localhost/' | ||
- : process.env.NEXT_PUBLIC_API_URL ?? | ||
- process.env.REACT_APP_API_URL ?? | ||
- (typeof window !== 'undefined' ? window.location.origin : '') | ||
+ : process.env.NEXT_PUBLIC_API_URL | ||
+ ? process.env.NEXT_PUBLIC_API_URL | ||
+ : process.env.REACT_APP_API_URL | ||
+ ? process.env.REACT_APP_API_URL | ||
+ : `${typeof window !== 'undefined' ? window.location.origin : ''}/${ | ||
+ process.env.NEXT_PUBLIC_API_ROUTE_PREFIX | ||
+ }` | ||
+ | ||
if (url && String(url).endsWith('/')) { | ||
url = url.slice(0, -1) | ||
} |