summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/related_merge_requests/index.js
blob: 092ff1df00f7136c12d9878a4d61d663e03ff678 (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
import Vue from 'vue';
import RelatedMergeRequests from './components/related_merge_requests.vue';
import createStore from './store';

export default function initRelatedMergeRequests() {
  const relatedMergeRequestsElement = document.querySelector('#js-related-merge-requests');

  if (relatedMergeRequestsElement) {
    const { endpoint, projectPath, projectNamespace } = relatedMergeRequestsElement.dataset;

    // eslint-disable-next-line no-new
    new Vue({
      el: relatedMergeRequestsElement,
      components: {
        RelatedMergeRequests,
      },
      store: createStore(),
      render: createElement =>
        createElement('related-merge-requests', {
          props: { endpoint, projectNamespace, projectPath },
        }),
    });
  }
}