From 37d4c637b3fe4ade514d9fbf10bf43f66fe24891 Mon Sep 17 00:00:00 2001 From: ismay Date: Tue, 8 Aug 2023 17:17:29 +0200 Subject: [PATCH] fix: use correct endpoint for update --- src/components/Forms/SequenceEditFormContainer.js | 6 +++++- src/hooks/job-queues/use-update-job-queue.js | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/Forms/SequenceEditFormContainer.js b/src/components/Forms/SequenceEditFormContainer.js index c4d901178..dbd1b4a42 100644 --- a/src/components/Forms/SequenceEditFormContainer.js +++ b/src/components/Forms/SequenceEditFormContainer.js @@ -11,7 +11,6 @@ const SequenceEditFormContainer = ({ sequence }) => { const redirect = () => { history.push('/') } - const [submitJobQueue] = useUpdateJobQueue({ onSuccess: redirect }) // Create an object with only the values we want to use as initial values const { cronExpression, name } = sequence @@ -21,6 +20,11 @@ const SequenceEditFormContainer = ({ sequence }) => { name, } + const [submitJobQueue] = useUpdateJobQueue({ + onSuccess: redirect, + initialName: initialValues.name, + }) + return (
({ data: ({ queue }) => queue, }) -const useUpdateJobQueue = ({ onSuccess } = {}) => { +const useUpdateJobQueue = ({ onSuccess, initialName } = {}) => { const engine = useDataEngine() const updateJobQueue = (queue) => { - const mutation = createMutation(queue.name) + const mutation = createMutation(initialName) return engine .mutate(mutation, { variables: { queue } }) .then(() => {