No Description

index.js 521B

12345678910111213141516171819
  1. import { USER_STATE_CHANGE } from '../constants/index'
  2. import firebase from 'firebase'
  3. export function fetchUser(){
  4. return((dispatch) => {
  5. firebase.firestore()
  6. .collection("Users")
  7. .doc(firebase.auth().currentUser.uid)
  8. .get()
  9. .then((snapshot) => {
  10. if(snapshot.exists){
  11. dispatch({type : USER_STATE_CHANGE, currentUser : snapshot.data()})
  12. }
  13. else{
  14. console.log('Does not exist')
  15. }
  16. })
  17. })
  18. }