fix(analytics): goatcounter pv greater than 1K cannot be converted to numbers (#1762)

The goatcounter PV report splits numbers with spaces, e.g. 1024 would be '1 024'
This commit is contained in:
Cotes Chung 2024-05-18 18:52:45 +08:00 committed by GitHub
parent 00a27a1b85
commit 33a1fa7cae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,7 +9,8 @@
fetch(url)
.then((response) => response.json())
.then((data) => {
pv.innerText = new Intl.NumberFormat().format(data.count);
const count = data.count.replace(/\s/g, '');
pv.innerText = new Intl.NumberFormat().format(count);
})
.catch((error) => {
pv.innerText = '1';