handel interval onlyShowAvaliable
This commit is contained in:
@@ -141,8 +141,6 @@ export default function Time(props) {
|
||||
};
|
||||
|
||||
const refreshRanges = () => {
|
||||
getLimit();
|
||||
getStats();
|
||||
fetch(`${prefix}/api/time/ranges`)
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
@@ -224,11 +222,17 @@ export default function Time(props) {
|
||||
|
||||
useEffect(() => {
|
||||
refreshRanges();
|
||||
getLimit();
|
||||
getStats();
|
||||
const interval = setInterval(() => {
|
||||
getLimit();
|
||||
getStats();
|
||||
if (!onlyShowAvaliable) {
|
||||
refreshRanges();
|
||||
}
|
||||
}, 1000);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
}, [onlyShowAvaliable]);
|
||||
|
||||
/*
|
||||
useEffect(() => {
|
||||
@@ -357,7 +361,7 @@ export default function Time(props) {
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{ranges.map((range) => {
|
||||
if (onlyShowAvaliable && range.name === "") {
|
||||
if (onlyShowAvaliable && range.username !== "") {
|
||||
return;
|
||||
}
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user