From 28326f2628686dc091f84b511dc5cdee7907194c Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 1 Jun 2021 16:49:54 -0700 Subject: [PATCH] IO-1176 Move duplication totals to server side. --- ...bs-detail-header-actions.duplicate.util.js | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js index 2a86cd9f7..f7f21864f 100644 --- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js +++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js @@ -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.