added refetch function for recall after takng any assign or unassign project for update

This commit is contained in:
Pramod Mahajan 2025-06-09 10:01:58 +05:30
parent 71631fa68d
commit e3731cab5f

View File

@ -145,11 +145,11 @@ export const useProjectsByEmployee = ( employeeId ) =>
setError(''); // clear previous error setError(''); // clear previous error
const res = await ProjectRepository.getProjectsByEmployee(id); const res = await ProjectRepository.getProjectsByEmployee(id);
setProjectList(res.data); setProjectList(res.data);
cacheData('ProjectsByEmployee', { data: res.data, employeeId: id }); cacheData( 'ProjectsByEmployee', {data: res.data, employeeId: id} );
setLoading(false)
} catch (err) { } catch (err) {
setError(err?.message || 'Failed to fetch projects'); setError( err?.message || 'Failed to fetch projects' );
} finally { setLoading(false)
setLoading(false);
} }
}; };
@ -171,8 +171,8 @@ export const useProjectsByEmployee = ( employeeId ) =>
return { return {
projectList, projectList,
loading, loading,
error error,
refetch : fetchProjects
} }
}; };