can remove a demarche
This commit is contained in:
parent
bc583e0fe2
commit
775e423914
3 changed files with 23 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue