Skip to content

Instantly share code, notes, and snippets.

@adamkpurdy
Last active August 16, 2018 18:05
Show Gist options
  • Select an option

  • Save adamkpurdy/e6726e6f00b60021e38fb669687be826 to your computer and use it in GitHub Desktop.

Select an option

Save adamkpurdy/e6726e6f00b60021e38fb669687be826 to your computer and use it in GitHub Desktop.
<template>
<div id="q-app">
<router-view />
</div>
</template>
<script>
import firebase from 'firebase';
import 'firebase/firestore';
import firebaseApp from 'firebase/app';
import * as configs from './utils/firebase/config';
export default {
name: 'App',
preFetch({ store }) {
// TODO: SET PRODUCTION CONFIG WHEN CI PUSHES TO PRODUCTION
// const config = (process.env.DEV) ? configs.dev : configs.prod;
firebaseApp.initializeApp(configs.dev);
const $db = firebase.firestore();
// Firebase requirement
$db.settings({
timestampsInSnapshots: true,
});
// Put firebase functionality into
// state for future access
Object.assign(store.state, {
$db: firebase.firestore(),
$firebase: firebaseApp,
});
},
};
</script>
<style></style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment