The StatusContext.jsx now supports the 'running'-field & runs every 5 seconds

This commit is contained in:
Mathias Wagner
2022-08-27 17:14:22 +02:00
parent 295aa429cc
commit bcacb3607e

View File

@@ -4,7 +4,7 @@ export const StatusContext = createContext();
export const StatusProvider = (props) => {
const [status, setStatus] = useState({paused: false});
const [status, setStatus] = useState({paused: false, running: false});
const updateStatus = () => {
let headers = localStorage.getItem("password") ? {password: localStorage.getItem("password")} : {}
@@ -15,7 +15,7 @@ export const StatusProvider = (props) => {
useEffect(() => {
updateStatus();
const interval = setInterval(() => updateStatus(), 15000);
const interval = setInterval(() => updateStatus(), 5000);
return () => clearInterval(interval);
}, []);