diff options
Diffstat (limited to 'modern')
-rw-r--r-- | modern/src/main/DevicesList.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/modern/src/main/DevicesList.js b/modern/src/main/DevicesList.js index e1db7853..a91b81e2 100644 --- a/modern/src/main/DevicesList.js +++ b/modern/src/main/DevicesList.js @@ -1,4 +1,4 @@ -import React, { useRef } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import makeStyles from '@mui/styles/makeStyles'; import { @@ -156,6 +156,15 @@ const DevicesList = ({ devices }) => { listInnerEl.current.className = classes.listInner; } + const [, setTime] = useState(Date.now()); + + useEffect(() => { + const interval = setInterval(() => setTime(Date.now()), 60000); + return () => { + clearInterval(interval); + }; + }, []); + useEffectAsync(async () => { const response = await fetch('/api/devices'); if (response.ok) { |