I am trying to follow along with a tutorial that is a bit outdated so I have to figure out some solutions on my own but the current Problem is that it seems like I am not recieving a snapshot, so .exists always returns false.
I would be thank full if somone could take a look
import { USER_STATE_CHANGE } from '../constants/index'
import firebase from 'firebase/compat/app';
export function fetchUser(){
return((dispatch) => {
firebase.firestore()
.collection("user")
.doc(firebase.auth().currentUser.uid)
.get()
.then((snapshot) => {
if(snapshot.exists){
console.log(snapshot.data())
dispatch({type: USER_STATE_CHANGE, currentUser: snapshot.data()})
}
else{
console.log('does not exist!')
}
})
})
}