Merge pull request #1945 from yumusb/patch-1

Fix "x-umami-cache: undefined"
This commit is contained in:
Mike Cao 2023-04-21 14:59:39 -07:00 committed by GitHub
commit 71628bec90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,11 +162,16 @@
const send = payload => {
if (trackingDisabled()) return;
const headers = {
'Content-Type': 'application/json'
};
if (typeof cache !== 'undefined') {
headers['x-umami-cache'] = cache;
}
return fetch(endpoint, {
method: 'POST',
body: JSON.stringify({ type: 'event', payload }),
headers: { 'Content-Type': 'application/json', ['x-umami-cache']: cache },
headers: headers
})
.then(res => res.text())
.then(text => (cache = text));