Chatwoot/app/controllers/api/v1/notification_subscriptions_controller.rb
Pranav Raj S e9131ea558
Feature: Add web push notification permission in frontend (#766)
Add webpush notification permission in frontend

Co-authored-by: Sojan <sojan@pepalo.com>
2020-05-06 00:10:56 +05:30

19 lines
505 B
Ruby

class Api::V1::NotificationSubscriptionsController < Api::BaseController
before_action :set_user
def create
notification_subscription = NotificationSubscriptionBuilder.new(user: @user, params: notification_subscription_params).perform
render json: notification_subscription
end
private
def set_user
@user = current_user
end
def notification_subscription_params
params.require(:notification_subscription).permit(:subscription_type, subscription_attributes: {})
end
end