fix: improve uptime data refresh error handling and confirm dialog for monitor deletion

This commit is contained in:
Usman Baig
2026-02-07 23:01:38 +01:00
parent 6040b5b27f
commit 027d2f50b6

View File

@@ -623,14 +623,14 @@ export default function UptimePage() {
loadData()
}, [loadData])
// * Auto-refresh every 30 seconds
// * Auto-refresh every 30 seconds; show toast on failure (e.g. network loss or auth expiry)
useEffect(() => {
const interval = setInterval(async () => {
try {
const statusData = await getUptimeStatus(siteId)
setUptimeData(statusData)
} catch {
// * Silent refresh failure
toast.error('Could not refresh uptime data. Check your connection or sign in again.')
}
}, 30000)
return () => clearInterval(interval)
@@ -679,7 +679,7 @@ export default function UptimePage() {
}
const handleDeleteMonitor = async (monitorId: string) => {
if (!confirm('Are you sure you want to delete this monitor? All historical data will be lost.')) return
if (!window.confirm('Are you sure you want to delete this monitor? All historical data will be lost.')) return
try {
await deleteUptimeMonitor(siteId, monitorId)
toast.success('Monitor deleted')