mirror of
https://github.com/logos-storage/logos-storage-frontend.git
synced 2026-01-07 15:53:13 +00:00
UPD upload now updates periodically
This commit is contained in:
parent
d6cc20fefa
commit
c3078124ff
@ -32,10 +32,37 @@ function UploadTab() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setUploads([]);
|
const fetchData = () => {
|
||||||
|
fetch(`/api/codex/v1/data`, {
|
||||||
|
headers: {
|
||||||
|
Authorization: nodeInfo.auth ? "Basic " + btoa(nodeInfo.auth) : "",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data) => {
|
||||||
|
setUploads(data);
|
||||||
|
setIsLoading(false);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error("Error fetching data: ", error);
|
||||||
|
setIsLoading(false);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchDataInterval = setInterval(() => {
|
||||||
|
// Fetch data at regular intervals (every 5 seconds)
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
// Fetch purchase IDs
|
fetchData();
|
||||||
getDatas();
|
}, 5000); // 5 seconds in milliseconds
|
||||||
|
|
||||||
|
// Fetch data immediately when the component mounts
|
||||||
|
setIsLoading(true);
|
||||||
|
fetchData();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
// Clean up interval on component unmount
|
||||||
|
clearInterval(fetchDataInterval);
|
||||||
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onDrop = useCallback(
|
const onDrop = useCallback(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user