add developer newsletters form

This commit is contained in:
Alex Turchyn
2023-07-01 13:43:46 +03:00
parent 4180d02a1b
commit 3cceaf5cc7
5 changed files with 36 additions and 1 deletions
+19
View File
@@ -0,0 +1,19 @@
# frozen_string_literal: true
class NewslettersController < ApplicationController
def show; end
def update
Faraday.post(Docuseal::NEWSLETTER_URL, newsletter_params.to_json, 'Content-Type' => 'application/json')
rescue StandardError => e
Rails.logger.error(e)
ensure
redirect_to root_path
end
private
def newsletter_params
params.require(:user).permit(:email)
end
end
+1 -1
View File
@@ -30,7 +30,7 @@ class SetupController < ApplicationController
sign_in(@user)
redirect_to root_path
redirect_to newsletter_path
else
render :index, status: :unprocessable_entity
end