title: vuex mutations replacing the whole state
body: <p>I am working with Vuex and I am quite new to it. I am wanting to commit data to the store and replace replace the  state with content of the payload. </p>
  
  <p>My store is built using modules and the module in question is the user module, </p>
  
  <p>Currently I am doing something like in my mutation, </p>
  
  <pre><code>setUser(state, payload) {
      state.user = {...payload.user}
  }
  </code></pre>
  
  <p>This makes my state looks like this after a run a commit</p>
  
  <pre><code>user: {
     user: {
       nickname: 'Bob',
       host: true,
       emoji: 'Smile',
       passcode: 12345678,
       room_id: 123
     }
  }
  </code></pre>
  
  <p>Ideally I don't want to have a user object in a user object, I either want each attribute of user to part of the state like, </p>
  
  <pre><code>state : {
      nickname: 'Bob',
      host: true,
      emoji: 'Smile',
      passcode: 12345678,
      room_id: 123
  }
  </code></pre>
  
  <p>or it could look like this, </p>
  
  <pre><code>state : {
      user: {
          nickname: 'Bob',
          host: true,
          emoji: 'Smile',
          passcode: 12345678,
          room_id: 123
      }
  }
  </code></pre>
  
  <p>I don't understand why I am getting <code>state.user.user</code>?</p>
  
  <p>here is the user module of my state,</p>
  
  <pre><code>export default {
  state: {
      user: {}
  },
  mutations: {
      setUser(state, payload) {
          state.user = {...payload.user}
      }
  },
  actions: {
  
  },
  getters: {
  
  }
  </code></pre>
  
  <p>};</p>
  
  <p>I have also tried the above with just <code>state:{}</code></p>