[Vuejs]-Using Vuex data right after setting them

0đź‘Ť

It’s because you didn’t return anything from promise.
Change you code:

this.setUser(firebase.auth().currentUser.uid).then(res => {
  this.name = res.userInfo.name;
});

Be sure that response returns property “userInfo”. It could be res.data.userInfo or something like this.

You can check that exactly the promise returns using console.log

this.setUser(firebase.auth().currentUser.uid).then(res => {
  console.log(res) // check browser's console
  this.name = res.userInfo.name;
});

Leave a comment