[Core] Add different request lib to telemetry_analytics
in place of $http
(#49671)
* Add axios to telemetry_analytics in place of . * Remove axios in favor of fetch.
This commit is contained in:
parent
ded8950559
commit
b4ecd5ab91
|
@ -47,14 +47,20 @@ interface AnalyicsReporterConfig {
|
|||
}
|
||||
|
||||
export function createAnalyticsReporter(config: AnalyicsReporterConfig) {
|
||||
const { localStorage, basePath, $http, debug } = config;
|
||||
const { localStorage, basePath, debug } = config;
|
||||
|
||||
return createReporter({
|
||||
debug,
|
||||
storage: localStorage,
|
||||
async http(report) {
|
||||
const url = `${basePath}/api/telemetry/report`;
|
||||
await $http.post(url, { report });
|
||||
await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'kbn-xsrf': 'true',
|
||||
},
|
||||
body: JSON.stringify({ report }),
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue