debian-mirror-gitlab/app/assets/javascripts/header_search/index.js

27 lines
686 B
JavaScript
Raw Normal View History

2021-11-11 11:23:49 +05:30
import Vue from 'vue';
import Translate from '~/vue_shared/translate';
import HeaderSearchApp from './components/app.vue';
import createStore from './store';
Vue.use(Translate);
export const initHeaderSearchApp = () => {
const el = document.getElementById('js-header-search');
if (!el) {
return false;
}
2021-11-18 22:05:49 +05:30
const { searchPath, issuesPath, mrPath, autocompletePath } = el.dataset;
2021-11-11 11:23:49 +05:30
let { searchContext } = el.dataset;
searchContext = JSON.parse(searchContext);
return new Vue({
el,
2021-11-18 22:05:49 +05:30
store: createStore({ searchPath, issuesPath, mrPath, autocompletePath, searchContext }),
2021-11-11 11:23:49 +05:30
render(createElement) {
return createElement(HeaderSearchApp);
},
});
};