My main.js file references #app as the el, and then on ready it sends an HTTP request to my API to get data on the user based on their token taken from localStorage.
It sets the data like so when the response is returned:
this.$http.get('/me', function(data) {
this.$set('me', data.me);
})
After the above request returns a response, data now looks like this:
data = {
me: {
email: '[email protected]',
name: 'Email Email'
}
}
And then in the main.js file I implement vue-router and my app is then bootstrapped. It renders my side navigation and other components, and in the middle there is a <router-view></router-view> for the main content.
Ex (app.html rendered from main.js):
<div is="navigation"></div>
<router-view></router-view>
In my navigation component, and furthermore my components rendered by the vue-router, how can I access data that I want to be global, for example me which is set in the root component?
I want to be able to access data like the user's e-mail and name all over the app.