Skip to content

Instantly share code, notes, and snippets.

@YousraBD
Created March 29, 2021 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YousraBD/1b8a13ae4614ac24bb2311f5b7803dc8 to your computer and use it in GitHub Desktop.
Save YousraBD/1b8a13ae4614ac24bb2311f5b7803dc8 to your computer and use it in GitHub Desktop.
// src/firebase.js
import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';
// TODO: Use a configuration object
firebaseApp.initializeApp({
projectId: '',
appId: '',
databaseURL: '',
storageBucket: '',
locationId: '',
apiKey: '',
authDomain: '',
messagingSenderId: '',
});
const db = firebase.firestore();
const auth = firebase.auth;
// eslint-disable-next-line no-restricted-globals
if (location.hostname === 'localhost') {
db.useEmulator('localhost', 8080);
auth().useEmulator('http://localhost:9099/', { disableWarnings: true });
}
export default firebase;
export { db, auth };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment