Skip to content

Commit

Permalink
fix: use correct endpoint for update
Browse files Browse the repository at this point in the history
  • Loading branch information
ismay committed Aug 8, 2023
1 parent d1ecf3b commit 37d4c63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/components/Forms/SequenceEditFormContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -21,6 +20,11 @@ const SequenceEditFormContainer = ({ sequence }) => {
name,
}

const [submitJobQueue] = useUpdateJobQueue({
onSuccess: redirect,
initialName: initialValues.name,
})

return (
<Form
name={sequence.name}
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/job-queues/use-update-job-queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const createMutation = (name) => ({
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(() => {
Expand Down

0 comments on commit 37d4c63

Please sign in to comment.