Chatwoot/app/controllers/api/v1/widget/labels_controller.rb
Sojan Jose 051871a3cd
Chore: Code Cleanup in API controllers (#932)
* Chore: Code Cleanup in API controllers

* Remove unnecessary scoping for accounts controller
2020-06-07 13:58:05 +05:30

21 lines
412 B
Ruby

class Api::V1::Widget::LabelsController < Api::V1::Widget::BaseController
def create
conversation.label_list.add(permitted_params[:label])
conversation.save!
head :no_content
end
def destroy
conversation.label_list.remove(permitted_params[:id])
conversation.save!
head :no_content
end
private
def permitted_params
params.permit(:id, :label, :website_token)
end
end