[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:
Justin Kambic 2019-10-31 12:05:38 -04:00 committed by GitHub
parent ded8950559
commit b4ecd5ab91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 }),
});
},
});
}