mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 18:26:20 +01:00
Update index.js
Do not send the x-umami-cache request header when the cache is not defined (the first request sent to the umami server when the visitor opens the page)
This commit is contained in:
parent
b39ef68372
commit
5d8fb2f791
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user