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; line.manual_line = true;
}); });
newJob.joblines = keepJobLines ? _tempLines : []; newJob.joblines = keepJobLines ? _tempLines : [];
newJob.job_totals = (
await Axios.post("/job/totals", {
job: newJob,
})
).data;
delete newJob.joblines; delete newJob.joblines;
newJob.joblines = keepJobLines ? { data: _tempLines } : null; newJob.joblines = keepJobLines ? { data: _tempLines } : null;
apolloClient const res2 = await apolloClient.mutate({
.mutate({ mutation: INSERT_NEW_JOB,
mutation: INSERT_NEW_JOB, variables: { job: [newJob] },
variables: { job: [newJob] }, });
}) await Axios.post("/job/totalsssu", {
.then((res2) => { id: res2.data.insert_jobs.returning[0].id,
if (completionCallback) });
completionCallback(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. //insert the new job. call the callback with the returned ID when done.