Merge pull request #1163 from rohandebsarkar/fetch-api

Update `tracker/index.js`: `SendBeacon()` to `Fetch API`
This commit is contained in:
Mike Cao 2022-05-24 20:39:57 -07:00 committed by GitHub
commit 4bddf37921
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,7 +122,11 @@ import { removeTrailingSlash } from '../lib/url';
payload,
});
navigator.sendBeacon(`${root}/api/collect`, data);
fetch(`${root}/api/collect`, {
method: 'POST',
body: data,
keepalive: true,
});
};
const addEvents = node => {