add a cooldown on the force refresh action (#1556)

This commit is contained in:
Athou
2024-09-20 14:03:20 +02:00
parent 0d75688ec8
commit 19c8db8b31
20 changed files with 121 additions and 22 deletions

View File

@@ -0,0 +1,10 @@
import { useEffect, useState } from "react"
export const useNow = (interval = 1000): Date => {
const [time, setTime] = useState(new Date())
useEffect(() => {
const t = setInterval(() => setTime(new Date()), interval)
return () => clearInterval(t)
}, [interval])
return time
}