In main.js of my app I dispatch an action that gets companies from my API and selects the first. This action dispatches every time, doesn't seem to fail here.
new Vue({
  el: '#app',
  store,
  router,
  render: h => h(App),
  created: function () {
    this.$store.dispatch('getCompaniesAndSelectFirst');
  }
})
In another view I need to retrieve campaigns that belong to the selected company, so I do this on mount with vue-resource.
mounted: function () {
  if (this.selectedCompanyId) {
    this.$http.get('Campaigns', {params: {companyId: this.selectedCompanyId}}).then(response => {
      // success callback
      this.numbersTableData = response.body;
    }, response => {
      // error callback
    });
  }
}
selectedCompanyId is my computed property that returns the id of the selected company in Vuex. 
selectedCompanyId: function () {
  return this.$store.getters.selectedCompanyId;
}
The issue is selectedCompanyId is undefined at this point if this is the first view that's loaded. 
If I refresh the page selectedCompanyId is still undefined and my get request fails.
If I open the application on this view, the selectedCompanyId is undefined and the get request fails, but if I route to another view and then route back selectedCompanyId has loaded and the request is successful.
If I open the application on another view, and then route to the view selectedCompanyId is defined and the get request is successful. 
As I understand it this is because my get request that gets companies and selects the first one needs time to complete.
How can I solve this? Is there a better way to do what I'm trying to do?
