diff options
author | Paul Slaughter <pslaughter@gitlab.com> | 2018-12-03 21:00:03 +0300 |
---|---|---|
committer | Paul Slaughter <pslaughter@gitlab.com> | 2018-12-05 23:40:06 +0300 |
commit | af20774b483103b6381077367af2c32c61c7aa67 (patch) | |
tree | d972df2a427fc6ea58ff37bcd9c60881424e5172 /app/assets | |
parent | 435a3d2ab5cf62aa45f35d1e7afc5c631e2c9c85 (diff) |
Update IDE index.js with 'extendStore'
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/ide/index.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/assets/javascripts/ide/index.js b/app/assets/javascripts/ide/index.js index fbf944499d5..6351948f750 100644 --- a/app/assets/javascripts/ide/index.js +++ b/app/assets/javascripts/ide/index.js @@ -1,5 +1,6 @@ import Vue from 'vue'; import { mapActions } from 'vuex'; +import _ from 'underscore'; import Translate from '~/vue_shared/translate'; import ide from './components/ide.vue'; import store from './stores'; @@ -13,19 +14,19 @@ Vue.use(Translate); * * @param {Element} el - The element that will contain the IDE. * @param {Object} options - Extra options for the IDE (Used by EE). - * @param {(e:Element) => Object} options.extraInitialData - - * Function that returns extra properties to seed initial data. * @param {Component} options.rootComponent - * Component that overrides the root component. + * @param {(store:Vuex.Store, el:Element) => Vuex.Store} options.extendStore - + * Function that receives the default store and returns an extended one. */ export function initIde(el, options = {}) { if (!el) return null; - const { extraInitialData = () => ({}), rootComponent = ide } = options; + const { rootComponent = ide, extendStore = _.identity } = options; return new Vue({ el, - store, + store: extendStore(store, el), router, created() { this.setEmptyStateSvgs({ @@ -41,7 +42,6 @@ export function initIde(el, options = {}) { }); this.setInitialData({ clientsidePreviewEnabled: parseBoolean(el.dataset.clientsidePreviewEnabled), - ...extraInitialData(el), }); }, methods: { |