title: Vue 2 About nextTick
body: <p>I have read that nextTick allows codes to be executed at the next action. But this does not work in my code, can someone helps me on this? Please correct me. Thanks.</p>
  
  <p>.vue</p>
  
  <pre><code>.....
  methods:{
        getUserInfo(){
          var vm = this
          vm.$http.get('/getAuthUser').then((response)=&gt;{
            vm.user = response.data
          })
          Vue.nextTick(()=&gt;{
            vm.$http.get('/getShop/'+vm.user.id).then((response)=&gt;{
              vm.shop = response.data.data.shop
            })
          })
        },
  }
  .....
  </code></pre>
  
  <p><code>{{user.id}}</code> does work. where this gives me the following error:</p>
  
  <blockquote>
    <p>GET <a href="http://localhost:8000/getShop/undefined" rel="nofollow noreferrer">http://localhost:8000/getShop/undefined</a> 404 (Not Found)</p>
  </blockquote>
  
  <p>EDIT#1
  if i do something like this it works but this should not be the right way to do in my opinion.</p>
  
  <pre><code>.....
  methods:{
        getUserInfo(){
          var vm = this
          vm.$http.get('/getAuthUser').then((response)=&gt;{
            vm.user = response.data
            vm.$http.get('/getShop/'+vm.user.id).then((response)=&gt;{
              vm.shop = response.data.data.shop
            })
          })
        },
  }
  .....
  </code></pre>
  
  <p>EDIT#2
  If I do something like this it wont work coz vm.user.id is not set.</p>
  
  <pre><code>.....
  methods:{
        getUserInfo(){
          var vm = this
          vm.$http.get('/getAuthUser').then((response)=&gt;{
            vm.user = response.data
          })
          vm.$http.get('/getShop/'+vm.user.id).then((response)=&gt;{
            vm.shop = response.data.data.shop
          })
        },
  }
  .....
  </code></pre>