title: Vuex getter returns undefined
body: <p>I have a vue app using vex to store site wide data I get the user info and put it into the state on the before create life cycle method like so:</p>
  
  <pre><code>const app = new Vue({
      el: '#app',
      store,
      beforeCreate(){
          store.dispatch('currentUser');
      }
  });
  </code></pre>
  
  <p>In my user module I have a getter that gets the name of the user like below:</p>
  
  <pre><code>const getters = {
      getName(state){
          return state.user.name;
      }
  };
  </code></pre>
  
  <p>In my components I am trying to access the getter to display the name of the user in the component. When I look into the Vue Chrome dev tools the getter is not undefined, but when I console log the getter results like so it says undefined.</p>
  
  <pre><code>mounted(){
      console.log(store.getters.getName);
  },
  </code></pre>
  
  <p>It seems like the component is loading before the state is loaded. I am getting the user info using axios. I am really confused on how to solve this since I can not call the action to get the user data any sooner that I know of.</p>
  
  <p>If in my getter method I do:</p>
  
  <pre><code>state.user
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code>{ "id": 1, "name": "Test" }
  </code></pre>
  
  <p>But when I try to get name I get undefined</p>
  
  <p>Here is the store:</p>
  
  <pre><code>import axios from "axios/index";
  
  const state = {
      user: {},
  };
  
  const mutations = {
      FETCH_USER(state,user){
          state.user = user;
      },
      UPDATE_AVATAR(state,avatar){
          state.user.avatar = avatar;
      }
  };
  
  const getters = {
      getName(state){
        return state.user.name
      },
      avatar(state){
          return state.user.avatar;
      },
      userSocialNetworks(state){
          //return state.user.social_networks
      },
      schoolName(state){
          return state.user.school
      },
      schoolAbout(state){
          return state.user.school.about
      },
      schoolAddress(state){
          return state.user.school.address
      }
  };
  
  const actions = {
      currentUser: ({commit}) =&gt; {
          axios.get('/api/user').then(response =&gt; {
              commit('FETCH_USER', response.data);
          });
  
      }
  }
  
  export default {
      state,
      getters,
      actions,
      mutations
  
  }
  
  
   {"user":{"user":{"name":"Test","email":"test@test.edu","avatar":"http://www.gravatar.com/avatar/xxxx=300","city":null,"state":null,"zip":null,"address":null,"lat":null,"long":null,"role":"school","school":{"id":1,"about":null,"header":null,"name":"Test","user_id":1,"created_at":"2018-06-06 19:48:16","updated_at":"2018-06-06 19:48:16"},"following":[],"followers":[],"social_networks":[{"id":4,"user_id":1,"social_network_id":1,"network_url":"test.com/k","created_at":"2018-06-06 23:11:09","updated_at":"2018-06-06 23:15:19"},{"id":5,"user_id":1,"social_network_id":2,"network_url":"test.com/k","created_at":"2018-06-06 23:15:19","updated_at":"2018-06-06 23:15:19"},{"id":6,"user_id":1,"social_network_id":5,"network_url":"test.com/k","created_at":"2018-06-06 23:16:15","updated_at":"2018-06-06 23:16:15"}]}},"socialNetowrks":{"available_networks":[{"id":1,"network_name":"Facebook","created_at":null,"updated_at":null},{"id":2,"network_name":"Instagram","created_at":null,"updated_at":null},{"id":5,"network_name":"Twitter","created_at":null,"updated_at":null}]}}
  </code></pre>