Use POST for action that creates data,

duh.

Turbo cleverly pre-fetches GET requests to save loading time. But that resulted in dozens of unwanted clones.
Attack of the clones!!!

I checked: even though this route predates the new products screen, it wasn't being used anywhere else. The old products screen uses the API instead.
This commit is contained in:
David Cook
2024-04-17 15:05:54 +10:00
parent 1d1169b478
commit 91f0a80189
2 changed files with 2 additions and 2 deletions

View File

@@ -37,7 +37,7 @@
%td.align-right
= render(VerticalEllipsisMenu::Component.new) do
= link_to t('admin.products_page.actions.edit'), edit_admin_product_path(product)
= link_to t('admin.products_page.actions.clone'), clone_admin_product_path(product)
= link_to t('admin.products_page.actions.clone'), clone_admin_product_path(product), method: :post
%a{ "data-controller": "modal-link", "data-action": "click->modal-link#setModalDataSetOnConfirm click->modal-link#open",
"data-modal-link-target-value": "product-delete-modal", "class": "delete",
"data-modal-link-modal-dataset-value": {'data-current-id': product.id}.to_json }

View File

@@ -59,7 +59,7 @@ Spree::Core::Engine.routes.draw do
resources :products, except: :index do
member do
get :clone
post :clone
get :group_buy_options
get :seo
end