Skip to content

Commit

Permalink
⛓️ fetch module list periodicaly (#577)
Browse files Browse the repository at this point in the history
* fetch module list periodicaly

* fetch module list periodicaly

* single fetching func
  • Loading branch information
petar-cvit committed Sep 27, 2024
1 parent 7b7d3cc commit c19397c
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions cyclops-ui/src/components/pages/Modules/Modules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,27 @@ const Modules = () => {

useEffect(() => {
setLoadingModules(true);
axios
.get(`/api/modules/list`)
.then((res) => {
setAllData(res.data);
setFilteredData(res.data);
setLoadingModules(false);
})
.catch((error) => {
setError(mapResponseError(error));
setLoadingModules(false);
});

function fetchModules() {
axios
.get(`/api/modules/list`)
.then((res) => {
setAllData(res.data);
setLoadingModules(false);
})
.catch((error) => {
setError(mapResponseError(error));
setLoadingModules(false);
});
}

fetchModules();
const interval = setInterval(() => fetchModules(), 10000);
return () => {
clearInterval(interval);
};
}, []);

useEffect(() => {
var updatedList = [...allData];
updatedList = updatedList.filter((module: any) => {
Expand Down

0 comments on commit c19397c

Please sign in to comment.