mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-18 10:01:56 +00:00
25 lines
488 B
TypeScript
25 lines
488 B
TypeScript
"use client";
|
|
|
|
import { useRouter } from "next/navigation";
|
|
import { useEffect } from "react";
|
|
|
|
interface AutoRefreshProps {
|
|
hasExecutingScan: boolean;
|
|
}
|
|
|
|
export function AutoRefresh({ hasExecutingScan }: AutoRefreshProps) {
|
|
const router = useRouter();
|
|
|
|
useEffect(() => {
|
|
if (!hasExecutingScan) return;
|
|
|
|
const interval = setInterval(() => {
|
|
router.refresh();
|
|
}, 5000);
|
|
|
|
return () => clearInterval(interval);
|
|
}, [hasExecutingScan, router]);
|
|
|
|
return null;
|
|
}
|