Add the setTimeOut leave and adjustment api call

This commit is contained in:
JaiPandey425 2025-12-04 12:06:45 +05:30
parent 9eeb14ffcd
commit 52e45f8328
1 changed files with 14 additions and 7 deletions

View File

@ -95,18 +95,25 @@ console.log("projectSummary46" , projectSummary)
// Combined refresh function // Combined refresh function
const handleRefresh = async () => { const handleRefresh = async () => {
if (activeTab === "leave") { // if (activeTab === "leave") {
await fetchLeaves(); // await fetchLeaves();
} else { // } else {
await fetchAdjustments(); // await fetchAdjustments();
} // }
fetchLeaves();
setTimeout(() => {
fetchAdjustments();
}, 0);
setLastRefreshed(new Date()); setLastRefreshed(new Date());
}; };
// Initial data fetch // Initial data fetch
useEffect(() => { useEffect(() => {
fetchLeaves(); fetchLeaves();
setTimeout(() => {
fetchAdjustments(); fetchAdjustments();
}, 0);
setLastRefreshed(new Date()); setLastRefreshed(new Date());
}, []); }, []);