Skip to content

Commit

Permalink
Replace fetch with http
Browse files Browse the repository at this point in the history
Signed-off-by: Julian Quispel <[email protected]>
  • Loading branch information
JulianQuispel committed May 2, 2024
1 parent cb1496a commit b6b8117
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions public/components/trace_analytics/components/common/indices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@
* SPDX-License-Identifier: Apache-2.0
*/

export async function loadTenantInfo(multitenancyEnabled: boolean) {
import { CoreStart } from '../../../../../../../src/core/public';

export async function loadTenantInfo(http: CoreStart['http'], multitenancyEnabled: boolean) {
if (!multitenancyEnabled) {
return;
}

return await fetch(`../api/v1/multitenancy/tenant`, {
headers: {
'Content-Type': 'application/json',
'osd-xsrf': 'true',
accept: '*/*',
'accept-language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.6',
pragma: 'no-cache',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
},
method: 'GET',
referrerPolicy: 'strict-origin-when-cross-origin',
mode: 'cors',
credentials: 'include',
})
return await http
.get(`../api/v1/multitenancy/tenant`, {
headers: {
'Content-Type': 'application/json',
'osd-xsrf': 'true',
accept: '*/*',
'accept-language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.6',
pragma: 'no-cache',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
},
referrerPolicy: 'strict-origin-when-cross-origin',
mode: 'cors',
credentials: 'include',
})
.then((response) => {
if (response.status === 404) {
// endpoint doesn't exist, security plugin is not enabled.
Expand Down

0 comments on commit b6b8117

Please sign in to comment.