I made a "OffersPlugin" that during "install" function get some data from server. And that data is needed in first component loaded in vue. But http request can't finish before vue component is loaded and I don't have any data to use.
How can I tell vue to hold init vue before plugin is ready?
Thank you.
import Vue from 'vue';
import VueCookie from 'vue-cookie';
import App from './ExampleComponent';
import OffersPlugin from '../plugins/OffersPlugin';
Vue.use(VueCookie);
Vue.use(OffersPlugin);
if(document.getElementById("vue-promotion-edit-section")) {
new Vue({
render: h => h(App)
}).$mount('#vue-promotion-edit-section');
In install method I have axios GET request. In that request I load from server list of offers. When request is success then I make plugin variable associated array:
const offerList = [];
As a prototype I use method getOfferId.
function(name)
{
return offersList[name] || 'No offer'
}