added missing job id
This commit is contained in:
parent
1358cd749a
commit
ea6686560d
@ -24,12 +24,10 @@ import { useParams } from "react-router-dom";
|
|||||||
|
|
||||||
const ManageJob = ({ Job }) => {
|
const ManageJob = ({ Job }) => {
|
||||||
const { projectId } = useParams();
|
const { projectId } = useParams();
|
||||||
|
|
||||||
const methods = useAppForm({
|
const methods = useAppForm({
|
||||||
resolver: zodResolver(jobSchema),
|
resolver: zodResolver(jobSchema),
|
||||||
defaultValues: defaultJobValue,
|
defaultValues: defaultJobValue,
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
register,
|
register,
|
||||||
control,
|
control,
|
||||||
@ -39,12 +37,6 @@ const ManageJob = ({ Job }) => {
|
|||||||
formState: { errors },
|
formState: { errors },
|
||||||
} = methods;
|
} = methods;
|
||||||
|
|
||||||
const {
|
|
||||||
data,
|
|
||||||
isLoading: isProjectLoading,
|
|
||||||
isError: isProjectError,
|
|
||||||
error,
|
|
||||||
} = useServiceProjects(ITEMS_PER_PAGE, 1);
|
|
||||||
const {
|
const {
|
||||||
data: JobTags,
|
data: JobTags,
|
||||||
isLoading: isTagLoading,
|
isLoading: isTagLoading,
|
||||||
@ -56,8 +48,7 @@ const ManageJob = ({ Job }) => {
|
|||||||
isLoading: isJobLoading,
|
isLoading: isJobLoading,
|
||||||
isError: isJobError,
|
isError: isJobError,
|
||||||
error: jobError,
|
error: jobError,
|
||||||
} = useServiceProjectJobDetails(Job?.jobId);
|
} = useServiceProjectJobDetails(Job);
|
||||||
|
|
||||||
const { mutate: CreateJob, isPending } = useCreateServiceProjectJob(() => {
|
const { mutate: CreateJob, isPending } = useCreateServiceProjectJob(() => {
|
||||||
reset();
|
reset();
|
||||||
});
|
});
|
||||||
@ -90,7 +81,7 @@ const ManageJob = ({ Job }) => {
|
|||||||
reset({
|
reset({
|
||||||
title: JobData.title ?? "",
|
title: JobData.title ?? "",
|
||||||
description: JobData.description ?? "",
|
description: JobData.description ?? "",
|
||||||
projectId: JobData.project?.id ?? projectId,
|
projectId: JobData.project?.id ?? projectId,
|
||||||
assignees: assignedEmployees,
|
assignees: assignedEmployees,
|
||||||
startDate: JobData.startDate ?? null,
|
startDate: JobData.startDate ?? null,
|
||||||
dueDate: JobData.dueDate ?? null,
|
dueDate: JobData.dueDate ?? null,
|
||||||
|
|||||||
@ -258,14 +258,10 @@ export const useUpdateServiceProjectJob = (onSuccessCallback) => {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async ({ id, payload }) => {
|
mutationFn: async ({ id, payload }) => {
|
||||||
|
|
||||||
// Call the repository patch
|
// Call the repository patch
|
||||||
const resp = await ServiceProjectRepository.UpdateJob(
|
const resp = await ServiceProjectRepository.UpdateJob(id, payload);
|
||||||
id,
|
|
||||||
payload
|
|
||||||
);
|
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
queryClient.invalidateQueries({ queryKey: ["serviceProjectJobs"] });
|
queryClient.invalidateQueries({ queryKey: ["serviceProjectJobs"] });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user