diff options
Diffstat (limited to 'app/assets/javascripts/snippets/index.js')
-rw-r--r-- | app/assets/javascripts/snippets/index.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/app/assets/javascripts/snippets/index.js b/app/assets/javascripts/snippets/index.js index 654856f8d14..b826110117c 100644 --- a/app/assets/javascripts/snippets/index.js +++ b/app/assets/javascripts/snippets/index.js @@ -3,19 +3,16 @@ import Translate from '~/vue_shared/translate'; import VueApollo from 'vue-apollo'; import createDefaultClient from '~/lib/graphql'; -import SnippetsApp from './components/app.vue'; +import SnippetsApp from './components/show.vue'; Vue.use(VueApollo); Vue.use(Translate); -export default () => { - const el = document.getElementById('js-snippet-view'); - +function appFactory(el, Component) { if (!el) { return false; } - const { snippetGid } = el.dataset; const apolloProvider = new VueApollo({ defaultClient: createDefaultClient(), }); @@ -24,11 +21,17 @@ export default () => { el, apolloProvider, render(createElement) { - return createElement(SnippetsApp, { + return createElement(Component, { props: { - snippetGid, + ...el.dataset, }, }); }, }); +} + +export const SnippetShowInit = () => { + appFactory(document.getElementById('js-snippet-view'), SnippetsApp); }; + +export default () => {}; |