summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/webhooks/index.js
blob: 1b2b33e44c109da9824fa60a70b213e97c9d9daf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import Vue from 'vue';
import FormUrlApp from './components/form_url_app.vue';

export default () => {
  const el = document.querySelector('.js-vue-webhook-form');

  if (!el) {
    return null;
  }

  const { url: initialUrl, urlVariables } = el.dataset;

  return new Vue({
    el,
    name: 'WebhookFormRoot',
    render(createElement) {
      return createElement(FormUrlApp, {
        props: {
          initialUrl,
          initialUrlVariables: urlVariables ? JSON.parse(urlVariables) : undefined,
        },
      });
    },
  });
};