rename destroy.turbo_stream to make it more generic

This commit is contained in:
Ahmed Ejaz
2024-05-24 02:40:34 +05:00
parent 039b0d80ee
commit 2bdf8e2853
2 changed files with 3 additions and 5 deletions

View File

@@ -32,19 +32,19 @@ module Admin
end
def destroy
@product = ProductScopeQuery.new(
@record = ProductScopeQuery.new(
spree_current_user,
{ id: params[:id] }
).find_product
if @product.destroy
if @record.destroy
flash[:success] = I18n.t('admin.products_v3.delete_product.success')
else
flash[:error] = I18n.t('admin.products_v3.delete_product.error')
end
respond_with do |format|
format.turbo_stream
format.turbo_stream { render :destroy_product_variant }
end
# using flash with turbo stream doesn't clear it because the page is not refreshed.

View File

@@ -1,2 +0,0 @@
= turbo_stream.remove dom_id(@product)
= render partial: "admin/shared/flashes", locals: { flashes: flash } if defined? flash