Skip to content

Commit

Permalink
add header
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Tabone <[email protected]>
  • Loading branch information
taban03 committed Dec 2, 2024
1 parent 52693e6 commit 20d8516
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions api-catalog-ui/frontend/src/epics/fetch-tiles.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ const terminatingStatusCodes = [500, 401, 403];
// override the termination if any of these APIM message codes are in the response
const excludedMessageCodes = ['ZWEAM104'];

/**
* Extract the ApimlId from the current URL
* @returns {string} The ApimlId
*/
function getApimlIdFromUrl() {
const pathname = window.location.pathname; // Get the path portion of the URL
const pathParts = pathname.split('/'); // Split the path into segments
return pathParts[1]; // Return the ApimlId (second segment)

This comment has been minimized.

Copy link
@Shobhajayanna

Shobhajayanna Dec 2, 2024

Contributor

this may not have apimlId if we are accessing the URL without domain. it will only have apicatalog.

}

function checkOrigin() {
// only allow the gateway url to authenticate the user
let allowOrigin = process.env.REACT_APP_GATEWAY_URL;
Expand Down Expand Up @@ -122,6 +132,7 @@ const createFetchTilesEpic =
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': origin(),
'X-Requested-With': 'XMLHttpRequest',
'X-ApimlId': getApimlIdFromUrl(),
},
}).pipe(
map((ajaxResponse) => {
Expand Down

0 comments on commit 20d8516

Please sign in to comment.