mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 00:55:37 +01:00
Added error handling for JSON.parse
This commit is contained in:
parent
2c80aa0b24
commit
109e8d6d31
1 changed files with 6 additions and 1 deletions
|
|
@ -233,7 +233,12 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const track = (obj, data) => {
|
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') {
|
if (typeof obj === 'string') {
|
||||||
return send({
|
return send({
|
||||||
...getPayload(),
|
...getPayload(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue