How to use the @firebase/app.firestore function in @firebase/app

To help you get started, we’ve selected a few @firebase/app examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gorgias / gorgias-chrome / src / store / plugin-firestore.js View on Github external
// Firestore plugin
import firebase from '@firebase/app';
import '@firebase/auth';
import '@firebase/firestore';

import Config from '../background/js/config';
import firebaseConfig from './config-firebase';

import _GORGIAS_API_PLUGIN from './plugin-api';

// firebase
firebase.initializeApp(firebaseConfig);

var db = firebase.firestore();

db.enablePersistence().catch((err) => {
    console.log('Firestore Persistance Error', err);
});

function mock () {
    return Promise.resolve();
}

function fsDate (date) {
    if (!date) {
        return firebase.firestore.Timestamp.now();
    }

    return firebase.firestore.Timestamp.fromDate(date);
}
github jelly-fin / jelly-fin / src / firebase-app.js View on Github external
// A config file that contains your firebase project credentials (not included in the repo)
const CONFIG = tryRequire('./firebase-config.json') || {
    apiKey: "AIzaSyAcq_Vr-wbCjctpWIXJdeXBHnQgSqCLRY8",
    authDomain: "jellyfin-a9ff6.firebaseapp.com",
    databaseURL: "https://jellyfin-a9ff6.firebaseio.com",
    projectId: "jellyfin-a9ff6",
    storageBucket: "",
    messagingSenderId: "505439361090"
};


// Initialize Cloud Firestore through Firebase
const app = firebase.initializeApp(CONFIG);

const db = firebase.firestore();

// Disable deprecated features
db.settings({
    timestampsInSnapshots: true,
});

// Add a document to a collection
db.collection("test-collection").add({
    title: 'post title',
    content: 'This is the test post content.',
    date: new Date(),
})
    .then(docRef => {
        console.log('Document written with ID: ', docRef);
    })
    .catch(error => {
github Hujjat / vue-shop / src / firebase.js View on Github external
import 'firebase/firestore'
import 'firebase/firebase-auth'
import 'firebase/storage'
  // Initialize Firebase
  var config = {
    apiKey: "AIzaSyDjDW8R09AFH9VifDGTZ5WSTURZnbaHURU",
    authDomain: "vue-shop-5a95e.firebaseapp.com",
    databaseURL: "https://vue-shop-5a95e.firebaseio.com",
    projectId: "vue-shop-5a95e",
    storageBucket: "vue-shop-5a95e.appspot.com",
    messagingSenderId: "892402191551"
  };
  
const fb = firebase.initializeApp(config);

const db = firebase.firestore();

export {fb,db}
github SkyJedi / RPG-Web-Character-Creator / src / firestoreDB.js View on Github external
const config = {
	apiKey: process.env.REACT_APP_apiKey,
	authDomain: process.env.REACT_APP_authDomain,
	databaseURL: process.env.REACT_APP_databaseURL,
	projectId: process.env.REACT_APP_projectId,
	storageBucket: process.env.REACT_APP_storageBucket,
	messagingSenderId: process.env.REACT_APP_messagingSenderId
};

firebase.initializeApp(config);
const firestore = firebase.firestore();
const settings = {timestampsInSnapshots: true};
firestore.settings(settings);
firestore.enablePersistence().catch(console.error);

export const db = firebase.firestore();
github SkyJedi / RPG-Web-Character-Creator / src / firestoreDB.js View on Github external
import firebase from '@firebase/app';
import '@firebase/firestore';

const config = {
	apiKey: process.env.REACT_APP_apiKey,
	authDomain: process.env.REACT_APP_authDomain,
	databaseURL: process.env.REACT_APP_databaseURL,
	projectId: process.env.REACT_APP_projectId,
	storageBucket: process.env.REACT_APP_storageBucket,
	messagingSenderId: process.env.REACT_APP_messagingSenderId
};

firebase.initializeApp(config);
const firestore = firebase.firestore();
const settings = {timestampsInSnapshots: true};
firestore.settings(settings);
firestore.enablePersistence().catch(console.error);

export const db = firebase.firestore();
github paularmstrong / react-stateful-firestore / src / index.js View on Github external
export default function init(app: App, userCollection?: string): Promise {
  if (store) {
    throw new Error('Cannot initialize store more than once.');
  }

  const firestore = firebase.firestore(app);
  const auth = firebase.auth(app);

  const thunkArgs = { auth, firestore };
  const middleware = [thunk.withExtraArgument(thunkArgs), batchMiddleware];

  if (process.env.NODE_ENV !== 'production') {
    const createLogger = require('redux-logger').createLogger;
    const logger = createLogger({ collapsed: true, diff: true });
    middleware.push(logger);
  }

  store = createStore(reducers, applyMiddleware(...middleware));
  if (process.env.NODE_ENV !== 'production') {
    window.redux = store;
  }
github syousif94 / frugalmaps / frugalapp / src / Firebase.js View on Github external
import store from "./store";
import * as Submissions from "./store/submissions";
import firebase from "@firebase/app";
import "firebase/firestore";

var config = {
  apiKey: "AIzaSyCMw-fDD28DLB0eWIR6PJQrDQfArisLvjw",
  authDomain: "frugalmaps.firebaseapp.com",
  databaseURL: "https://frugalmaps.firebaseio.com",
  projectId: "frugalmaps",
  storageBucket: "frugalmaps.appspot.com",
  messagingSenderId: "279259204952"
};
firebase.initializeApp(config);

export const db = firebase.firestore();

firebase.firestore.setLogLevel("silent");

db.settings({
  timestampsInSnapshots: true
});

db.collection("submissions").onSnapshot(snapshot => {
  snapshot.docChanges().forEach(change => {
    if (change.type === "added") {
      store.dispatch(
        Submissions.actions.set({
          newData: [{ ...change.doc.data(), id: change.doc.id }]
        })
      );
    }
github paularmstrong / react-stateful-firestore / src / Provider.js View on Github external
getChildContext() {
    const { app, select, selectAuth, selectStorage, store } = this.props.store;
    return {
      firebase: {
        app,
        auth: firebase.auth(app),
        firestore: firebase.firestore(app),
        messaging: firebase.messaging(app),
        select,
        selectAuth,
        selectStorage,
        storage: firebase.storage(app),
        store
      }
    };
  }
github engaging-computing / MYR / src / firebase.js View on Github external
apiKey: firebaseKey,
    authDomain: "myrjsecg.firebaseapp.com",
    databaseURL: "https://myrjsecg.firebaseio.com",
    projectId: "myrjsecg",
    storageBucket: "gs://myrjsecg.appspot.com",
    messagingSenderId: "967963389163"
};

firebase.initializeApp(config);
export default firebase;
export const provider = new firebase.auth.GoogleAuthProvider();
provider.setCustomParameters({
    prompt: "select_account"
});
export const auth = firebase.auth();
export const db = firebase.firestore();
export const scenes = db.collection("scenes");
export const snaps = db.collection("snaps");
export const classes = db.collection("classes");
export const storageRef = firebase.storage().ref();