edit tracker script to work under SSR sites

pull/1644/head
Sergei Meza 2022-10-18 11:05:25 +09:00
parent bf4de2fbf5
commit 019343085f
1 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,4 @@
/* eslint-disable no-console */
(window => { (window => {
const { const {
screen: { width, height }, screen: { width, height },
@ -84,7 +85,7 @@
}); });
const getClientIPAddress = () => { const getClientIPAddress = () => {
return new Promise(res => { return new Promise((res, rej) => {
if (ip) { if (ip) {
res(ip); res(ip);
return; return;
@ -95,6 +96,10 @@
ip = data.ip; ip = data.ip;
res(ip); res(ip);
return; return;
})
.catch(err => {
console.error(err);
rej(err);
}); });
}); });
}; };