I am having trouble figuring out how to save data from Firestore. I attempted saving it using this.favLists so that I wouldn't have to send requests each time I make a request.
export default defineComponent({
data() {
return{
favLists: '',
}
},
methods: {
async getFavorite() {
var docRef =
db.collection("userFavorites").doc(this.currentUser.uid);
docRef.get().then(function(doc) {
if (doc.exists) {
this.favLists = doc.data()
console.log(doc.data())
console.log(this.favLists)
} else {
console.log("No such document!");
}
}).catch(function(error) {
console.log("Error getting document:", error);
});
},