每五秒获取调取告警接口
// 告警数量
const getAlarm = () => {
getAlarmCount().then(
(res: any) => {
if (res.code == 200) {
setCount(res.data)
clearTimeout(time)
time = setTimeout(() => {
getAlarm()
}, 5000);
}
}
)
}
useEffect(() => {
getAlarm()
return () => {
clearTimeout(time)
}
}, [])