Witam, jak wywołać funkcję z created
? Mam taki kod, nie działa (probowałem dodać this, nie pomaga)
...
loadFromDatabase(){
let docRef = firebase.firestore().collection('users').doc(firebase.auth().currentUser.uid);
docRef.get().then(function(doc) {
if (doc.exists) {
this.notepad=doc.data().notepad;
} else {
// doc.data() will be undefined in this case
console.log("No such document!");
}
}).catch(function(error) {
console.log("Error getting document:", error);
});
}
},
created: ()=>{
loadFromDatabase();
}
...