in my apps in order to get global data from laravel into my vue components I had a route middleware where I get global data from my eloquent queries, then I shared this data with my views and passed the data as props into each component, this has proven to work really good so far but can become a bit tricky when I have nested components (one component inside another), obviously I thought having a Globals vuex module would solve this.
I could call a vuex action which could make an ajax request to my global variables endpoint and populate my state each time the vue instance is created but that would mean an extra ajax request to my backend which I generally avoid.
My second idea is having a navbar component which an ajax request to fetch globals on mounted hook, this component would teorically be loaded first and populate my state, not sure if this would work to be honest.
Any ideas?