Added error handling for JSON.parse

This commit is contained in:
perso182 2025-03-31 10:14:31 +02:00
parent 2c80aa0b24
commit 109e8d6d31

View file

@ -233,7 +233,12 @@
};
const track = (obj, data) => {
const identity = JSON.parse(localStorage.getItem('umami.identity'));
let identity;
try {
identity = JSON.parse(localStorage.getItem('umami.identity'));
} catch (error) {
identity = null;
}
if (typeof obj === 'string') {
return send({
...getPayload(),