Fixed error of api call before submiting create form

This commit is contained in:
ashutosh.nehete 2025-04-09 11:08:39 +05:30
parent e8aa2ae718
commit 1f5d4688bb

View File

@ -240,8 +240,7 @@ export const useEmployeeProfile =(employeeId)=>{
const fetchData = async () => {
const Employee_cache = getCachedData("employeeProfile");
if(!Employee_cache || Employee_cache.employeeId !== employeeId){
EmployeeRepository.getEmployeeProfile(employeeId)
.then((response) => {
setEmployees(response.data);
@ -260,7 +259,9 @@ export const useEmployeeProfile =(employeeId)=>{
};
useEffect(()=>{
fetchData(employeeId);
if(employeeId){
fetchData(employeeId);
}
},[employeeId])
return {employee,loading,error}