mirror of
https://github.com/logos-storage/logos-storage-frontend.git
synced 2026-01-02 13:23:09 +00:00
UPD upload now updates periodically
This commit is contained in:
parent
d6cc20fefa
commit
c3078124ff
@ -32,10 +32,37 @@ function UploadTab() {
|
||||
});
|
||||
}
|
||||
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);
|
||||
// Fetch purchase IDs
|
||||
getDatas();
|
||||
fetchData();
|
||||
}, 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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user