Skip to content

Instantly share code, notes, and snippets.

@zackbraksa
Last active March 29, 2021 13:24
Show Gist options
  • Save zackbraksa/aebd4ecb3e1821c7c14dbac177d8d958 to your computer and use it in GitHub Desktop.
Save zackbraksa/aebd4ecb3e1821c7c14dbac177d8d958 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