can remove a demarche

This commit is contained in:
simon lehericey 2024-01-30 09:57:43 +01:00
parent bc583e0fe2
commit 775e423914
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
3 changed files with 23 additions and 5 deletions

View file

@ -5,7 +5,7 @@ module Administrateurs
include ActionView::RecordIdentifier
before_action :authenticate_administrateur!
before_action :set_api_token, only: [:edit, :update, :destroy]
before_action :set_api_token, only: [:edit, :update, :destroy, :remove_procedure]
def nom
@name = name
@ -74,6 +74,15 @@ module Administrateurs
render :edit
end
def remove_procedure
procedure_id = params[:procedure_id].to_i
@api_token.allowed_procedure_ids =
@api_token.allowed_procedure_ids - [procedure_id]
@api_token.save!
render turbo_stream: turbo_stream.remove("authorized_procedure_#{procedure_id}")
end
def destroy
@api_token.destroy