delete api token : remove unused template and use turbo

This commit is contained in:
simon lehericey 2024-01-26 14:52:28 +01:00
parent b64a32444c
commit 35e9a6e905
3 changed files with 5 additions and 6 deletions

View file

@ -1,4 +1,4 @@
%li.fr-mt-2w.flex
%li.fr-mt-2w.flex{ id: dom_id(@api_token) }
.fr-mr-4w{ class: class_names('fr-text-default--success': recently_used?) }
%span.fr-icon-key-line
.flex-grow
@ -11,6 +11,5 @@
%div
= link_to 'Supprimer',
admin_api_token_path(@api_token),
method: :delete,
class: 'fr-btn fr-btn--tertiary-no-outline fr-btn--sm fr-btn--icon-left fr-icon-delete-line',
data: { confirm: "Confirmez-vous la suppression du jeton « #{@api_token.name} » ?" }
data: { turbo_method: :delete, confirm: "Confirmez-vous la suppression du jeton « #{@api_token.name} » ?" }

View file

@ -1,5 +1,7 @@
module Administrateurs
class APITokensController < AdministrateurController
include ActionView::RecordIdentifier
before_action :authenticate_administrateur!
before_action :set_api_token, only: [:destroy]
@ -33,7 +35,7 @@ module Administrateurs
def destroy
@api_token.destroy
redirect_to profil_path
render turbo_stream: turbo_stream.remove(dom_id(@api_token))
end
private

View file

@ -1,2 +0,0 @@
= turbo_stream.replace dom_id(current_administrateur, :profil_api_token) do
= render Profile::APITokenCardComponent.new created_api_token: @api_token, created_packed_token: @packed_token