mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
895 B
35 lines
895 B
# frozen_string_literal: true
|
|
|
|
require 'faraday'
|
|
|
|
class ExportController < ApplicationController
|
|
skip_authorization_check
|
|
skip_before_action :maybe_redirect_to_setup
|
|
skip_before_action :verify_authenticity_token
|
|
|
|
# Send template to third party.
|
|
def export_template
|
|
data = request.raw_post.present? ? JSON.parse(request.raw_post) : params.to_unsafe_h
|
|
service = ExportTemplateService.new(data)
|
|
|
|
if service.call
|
|
head :ok
|
|
else
|
|
redirect_to root_path, alert: service.error_message
|
|
end
|
|
end
|
|
|
|
# Send submission to third party.
|
|
def export_submission
|
|
submission = Submission.find(params[:id])
|
|
service = ExportSubmissionService.new(submission)
|
|
|
|
if service.call
|
|
redirect_to submission, notice: "Submission ##{submission.id} events exported successfully."
|
|
else
|
|
redirect_to submission, alert: service.error_message
|
|
end
|
|
end
|
|
|
|
end
|