summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/related_merge_requests/index.js
blob: ce33cf7df1d1157c8c605c11584ac7ec9d1d050c (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 },
        }),
    });
  }
}