add webhook settings

This commit is contained in:
Alex Turchyn
2023-08-05 15:25:16 +03:00
parent 8929adbe83
commit e4bb5466f5
15 changed files with 198 additions and 18 deletions
+17 -9
View File
@@ -5,9 +5,9 @@
<div class="card bg-base-200">
<div class="card-body p-6">
<label for="api_key" class="text-sm font-semibold">X-Auth-Token</label>
<div class=" flex flex-row space-x-4">
<div class="flex flex-row space-x-4">
<input id="api_key" type="text" value="<%= jwt = JsonWebToken.encode(uuid: current_user.uuid, scope: :api) %>" class="input font-mono input-bordered w-full" autocomplete="off" readonly>
<%= render 'shared/clipboard_copy', text: jwt, class: 'base-button', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy', copied_title: 'Copied' %>
<%= render 'shared/clipboard_copy', icon: 'copy', text: jwt, class: 'base-button', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy', copied_title: 'Copied' %>
</div>
</div>
</div>
@@ -25,12 +25,16 @@
</div>
<div class="collapse-content" style="display: inherit">
<div class="mockup-code overflow-hidden">
<pre data-prefix="$"><code class="overflow-hidden w-full">curl --location '<%= api_submissions_url %>' \
<% text = capture do %>curl --location '<%= api_submissions_url %>' \
--header 'X-Auth-Token: <%= jwt %>' \
--data-raw '{
"template_id": <%= current_account.templates.last.id %>,
"template_id": <%= current_account.templates.last&.id || 1 %>,
"emails": "<%= current_user.email.sub('@', '+test@') %>, <%= current_user.email.sub('@', '+test2@') %>"
}'</code></pre>
}'<% end.to_str %>
<span class="top-0 right-0 absolute">
<%= render 'shared/clipboard_copy', icon: 'copy', text:, class: 'btn btn-ghost text-white', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy', copied_title: 'Copied' %>
</span>
<pre data-prefix="$"><code class="overflow-hidden w-full"><%= text %></code></pre>
</div>
</div>
</div>
@@ -47,19 +51,23 @@
</div>
<div class="collapse-content" style="display: inherit">
<div class="mockup-code overflow-hidden">
<pre data-prefix="$"><code class="overflow-hidden w-full">curl --location '<%= api_submissions_url %>' \
<% text = capture do %>curl --location '<%= api_submissions_url %>' \
--header 'X-Auth-Token: <%= jwt %>' \
--data-raw '{
"template_id": <%= current_account.templates.last.id %>,
"template_id": <%= current_account.templates.last&.id || 1 %>,
"submission": [
{
"submitters": [
{ "name": "<%= current_account.templates.last.submitters.first['name'] %>", "email": "<%= current_user.email.sub('@', '+test@') %>" },
{ "name": "<%= current_account.templates.last ? current_account.templates.last.submitters.first['name'] : 'First Submitter' %>", "email": "<%= current_user.email.sub('@', '+test@') %>" },
{ "name": "Second Submitter", "email": "<%= current_user.email.sub('@', '+test2@') %>" }
]
}
]
}'</code></pre>
}'<% end.to_str %>
<span class="top-0 right-0 absolute">
<%= render 'shared/clipboard_copy', icon: 'copy', text:, class: 'btn btn-ghost text-white', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy', copied_title: 'Copied' %>
</span>
<pre data-prefix="$"><code class="overflow-hidden w-full"><%= text %></code></pre>
</div>
</div>
</div>