selectProject was missing to defined in - useSuspendEmployee - therefor getting this - selected Project is not defined but actually employee is suspended properly, but show just extrap error msg

This commit is contained in:
pramod mahajan 2025-07-17 13:07:36 +05:30
parent 6bf33b27a0
commit b9c240261c

View File

@ -213,7 +213,7 @@ export const useUpdateEmployee = () =>
export const useSuspendEmployee = ({ setIsDeleteModalOpen, setemployeeLodaing }) => { export const useSuspendEmployee = ({ setIsDeleteModalOpen, setemployeeLodaing }) => {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const selectedProject = useSelector((store)=>store.localVariables.projectId)
return useMutation({ return useMutation({
mutationFn: (id) => { mutationFn: (id) => {
setemployeeLodaing(true); setemployeeLodaing(true);
@ -221,12 +221,12 @@ export const useSuspendEmployee = ({ setIsDeleteModalOpen, setemployeeLodaing })
}, },
onSuccess: () => { onSuccess: () => {
showToast("Employee deleted successfully.", "success");
// queryClient.invalidateQueries( ['allEmployee',false]); // queryClient.invalidateQueries( ['allEmployee',false]);
queryClient.invalidateQueries( {queryKey: [ 'projectEmployees' ]} ); queryClient.invalidateQueries( {queryKey: [ 'projectEmployees' ]} );
queryClient.invalidateQueries( {queryKey:[ 'employeeListByProject' ,selectedProject]} ); queryClient.invalidateQueries( {queryKey:[ 'employeeListByProject' ,selectedProject]} );
showToast("Employee deleted successfully.", "success");
setIsDeleteModalOpen(false); setIsDeleteModalOpen(false);
}, },