matestack-ui-core icon indicating copy to clipboard operation
matestack-ui-core copied to clipboard

Follow response in Forms not working for PUT or PATCH requests

Open NdotHenning opened this issue 5 years ago • 0 comments

What is the current behavior? follow_response funktioniert nicht für method: :put oder method: :patch. Wenn ich in einer Form bei success eine Transition auf einen anderen Pfad machen möchte, wird, wenn die Form mit put/patch submitted wurde, vom Server der angegebene Pfad mit method: :put/patch angefragt. Für eine Form submitted mit method: :post wird bei follow_response: true die erhaltene URL mit GET beim Server angefragt.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug might get fixed faster if we can run your code and it doesn't have extra dependencies. Add a link to a sample repo and/or any relevant code below:

# A edit page

def response
  components {
    form form_config, :include do
      form_submit do
        button text: 'submit'
      end
    end
  }
end

protected

def form_config
    {
      for: some_model,
      path: some_model_path(some_model),
      method: :patch,
      failure: {
        emit: 'form_failure'
      },
      success: {
        transition: {
          follow_response: true
        }
      }
    }
  end
# controller

def edit
  render Pages::Edit
end

def update
  some_model = SomeModel.find(params[:id])
  redirect_to edit_some_model_path(some_model)
end

What is the expected behavior? Request the redirect_to path from the controller action as GET. Like it is happening for method: :post.

Which versions of Matestack, and which browser/OS are affected by this issue? Did this work in previous versions of Matestack?

Matestack 0.7.5

NdotHenning avatar Mar 17 '20 11:03 NdotHenning