Merge branch 'master' into dev

This commit is contained in:
Mike Cao 2023-04-21 15:16:26 -07:00
commit eaaf3a0a5c

View File

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