Having trouble setting a variable with data retrieved using a get() function on Firebase.
export default {
name: "customer-navigation",
mixins: [navigationMixin],
components:{AppSnackBar, authModule,AuthForm},
data () {
return {
drawer: false,
items: [
{ title: this.$t('navigation.home'), icon: 'home', to: '/' },
{ title: this.$t('navigation.shop'), icon: 'shopping_basket', to:
'/shop' },
{ title: this.$t('navigation.cart'), icon: 'shopping_cart', to:
'/cart' },
{ title: this.$t('navigation.orders'), icon: 'view_headline', to:
'/orders' },
],
img_url: "" ,
nombreFire: "",
}
},
methods: {
getInfo(){
db.collection('users').doc(authModule.state.user.uid).get().then(function(doc) {
this.img_url = doc.data().img_url
})
}
}
}
Encountering an error - Uncaught (in promise) TypeError: Cannot set property 'img_url' of undefined. This is the error message being displayed.