Only add a timer on click

This commit is contained in:
Ayase Minori 2023-09-12 06:43:06 +00:00 committed by GitHub
parent 1a42b2ccf0
commit 38df720102
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,11 +23,6 @@ export default function Counter(props: SharedProps) {
// whenever a user activity is detected
let timer: number;
timer = setTimeout(() => {
axios.post(window.location.href, JSON.stringify({ data: internalCount }));
setInternalCount(0);
}, 5000)
window.onclick = () => {
clearTimeout(timer);
timer = setTimeout(() => {