251208:1625 Frontend: to be complete admin panel, Backend: tobe recheck all task
This commit is contained in:
@@ -70,4 +70,23 @@ export function useSubmitCorrespondence() {
|
||||
});
|
||||
}
|
||||
|
||||
export function useProcessWorkflow() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ id, data }: { id: number | string; data: any }) =>
|
||||
correspondenceService.processWorkflow(id, data),
|
||||
onSuccess: (_, { id }) => {
|
||||
toast.success('Action completed successfully');
|
||||
queryClient.invalidateQueries({ queryKey: correspondenceKeys.detail(id) });
|
||||
queryClient.invalidateQueries({ queryKey: correspondenceKeys.lists() });
|
||||
},
|
||||
onError: (error: any) => {
|
||||
toast.error('Failed to process action', {
|
||||
description: error.response?.data?.message || 'Something went wrong',
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Add more mutations as needed (update, delete, etc.)
|
||||
|
||||
@@ -22,4 +22,12 @@ export function useDisciplines(contractId?: number) {
|
||||
});
|
||||
}
|
||||
|
||||
// Add other master data hooks as needed
|
||||
// Add useContracts hook
|
||||
import { projectService } from '@/lib/services/project.service';
|
||||
export function useContracts(projectId: number = 1) {
|
||||
return useQuery({
|
||||
queryKey: ['contracts', projectId],
|
||||
queryFn: () => projectService.getContracts(projectId),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user