Welcome to mirror list, hosted at ThFree Co, Russian Federation.

profile_preferences_bundle.js « preferences « profile « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 744e0174a4e168add401cbbe3e9897faa8fab969 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import Vue from 'vue';
import ProfilePreferences from './components/profile_preferences.vue';

export default () => {
  const el = document.querySelector('#js-profile-preferences-app');
  const shouldParse = ['integrationViews', 'userFields'];

  const provide = Object.keys(el.dataset).reduce((memo, key) => {
    let value = el.dataset[key];
    if (shouldParse.includes(key)) {
      value = JSON.parse(value);
    }

    return { ...memo, [key]: value };
  }, {});

  return new Vue({
    el,
    name: 'ProfilePreferencesApp',
    provide,
    render: (createElement) => createElement(ProfilePreferences),
  });
};