Fixed error of api call before submiting create form
This commit is contained in:
parent
e8aa2ae718
commit
1f5d4688bb
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user