IO-1176 Move duplication totals to server side.

This commit is contained in:
Patrick Fic
2021-06-01 16:49:54 -07:00
parent 7c35a2e790
commit 28326f2628

View File

@@ -39,24 +39,20 @@ export default async function DuplicateJob(
line.manual_line = true;
});
newJob.joblines = keepJobLines ? _tempLines : [];
newJob.job_totals = (
await Axios.post("/job/totals", {
job: newJob,
})
).data;
delete newJob.joblines;
newJob.joblines = keepJobLines ? { data: _tempLines } : null;
apolloClient
.mutate({
mutation: INSERT_NEW_JOB,
variables: { job: [newJob] },
})
.then((res2) => {
if (completionCallback)
completionCallback(res2.data.insert_jobs.returning[0].id);
});
const res2 = await apolloClient.mutate({
mutation: INSERT_NEW_JOB,
variables: { job: [newJob] },
});
await Axios.post("/job/totalsssu", {
id: res2.data.insert_jobs.returning[0].id,
});
if (completionCallback)
completionCallback(res2.data.insert_jobs.returning[0].id);
//insert the new job. call the callback with the returned ID when done.