diff options
Diffstat (limited to 'app/assets/javascripts/static_site_editor/index.js')
-rw-r--r-- | app/assets/javascripts/static_site_editor/index.js | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/app/assets/javascripts/static_site_editor/index.js b/app/assets/javascripts/static_site_editor/index.js index 15d668fd431..12aa301e02f 100644 --- a/app/assets/javascripts/static_site_editor/index.js +++ b/app/assets/javascripts/static_site_editor/index.js @@ -1,29 +1,32 @@ import Vue from 'vue'; -import StaticSiteEditor from './components/static_site_editor.vue'; -import createStore from './store'; +import { parseBoolean } from '~/lib/utils/common_utils'; +import App from './components/app.vue'; +import createRouter from './router'; +import createApolloProvider from './graphql'; const initStaticSiteEditor = el => { - const { projectId, path: sourcePath, returnUrl } = el.dataset; - const isSupportedContent = 'isSupportedContent' in el.dataset; + const { isSupportedContent, path: sourcePath, baseUrl, namespace, project } = el.dataset; + const { current_username: username } = window.gon; + const returnUrl = el.dataset.returnUrl || null; - const store = createStore({ - initialState: { - isSupportedContent, - projectId, - returnUrl, - sourcePath, - username: window.gon.current_username, - }, + const router = createRouter(baseUrl); + const apolloProvider = createApolloProvider({ + isSupportedContent: parseBoolean(isSupportedContent), + project: `${namespace}/${project}`, + returnUrl, + sourcePath, + username, }); return new Vue({ el, - store, + router, + apolloProvider, components: { - StaticSiteEditor, + App, }, render(createElement) { - return createElement('static-site-editor', StaticSiteEditor); + return createElement('app'); }, }); }; |