I'm building an application with Firebase oAuth. I followed all the instructions, but my code is returning an error saying that 'asyn arrow function expected no return value'.
I saw that there are multiple posts with the same title, but have not found an answer.
import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/auth';
export const auth = firebase.auth();
export const firestore = firebase.firestore();
const config = {
apiKey: 'XXXXXXXXX',
authDomain: 'XXXXXXXXX',
projectId: 'XXXXXXXXX',
storageBucket: 'XXXXXXXXX',
messagingSenderId: 'XXXXXXXXX',
appId: 'XXXXXXXXX',
};
firebase.initializeApp(config);
export const createUserProfileDocument = async (userAuth, additionalData) => {
if (!userAuth) return;
const userRef = firestore.doc(`users/${userAuth.uid}`);
const snapShot = await userRef.get();
if (!snapShot.exists) {
const { displayName, email } = userAuth;
const createdAt = new Date();
try {
await userRef.set({
displayName,
email,
createdAt,
...additionalData,
});
} catch (error) {
console.log('error creating user', error.message);
}
}
return userRef;
};
const provider = new firebase.auth.GoogleAuthProvider();
provider.setCustomParameters({ prompt: 'select_account' });
export const signInWithGoogle = () => auth.signInWithPopup(provider);
export default firebase;