Merge pull request #3 from CChannel/meza/update-tracker
save user ip on the window to cache itpull/1644/head
commit
94f512fa2b
|
@ -86,14 +86,16 @@
|
||||||
|
|
||||||
const getClientIPAddress = () => {
|
const getClientIPAddress = () => {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
if (ip) {
|
if (window.ip) {
|
||||||
res(ip);
|
ip = window.ip;
|
||||||
|
res(window.ip);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fetch('https://api64.ipify.org/?format=json')
|
fetch('https://api64.ipify.org/?format=json')
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
ip = data.ip;
|
ip = data.ip;
|
||||||
|
window.ip = data.ip;
|
||||||
res(ip);
|
res(ip);
|
||||||
return;
|
return;
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue