Skip to content

Instantly share code, notes, and snippets.

@ahoward
Created August 12, 2018 20:16
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 ahoward/b9f61a396f81a206159a0ecba5b19954 to your computer and use it in GitHub Desktop.
Save ahoward/b9f61a396f81a206159a0ecba5b19954 to your computer and use it in GitHub Desktop.
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
//
import Vue from 'vue'
import App from './App'
import router from './router'
import firebase from 'firebase'
Vue.config.productionTip = false
// TODO - factor out this config into dev/prod/staging based configs
var config = { // dojo4@dojo4.com
apiKey: "AIzaSyDVn1M1LqAKXKk5t7s2FJGMVATruprvh7k",
authDomain: "su2c-tribute-5f922.firebaseapp.com",
databaseURL: "https://su2c-tribute-5f922.firebaseio.com",
projectId: "su2c-tribute-5f922",
storageBucket: "su2c-tribute-5f922.appspot.com",
messagingSenderId: "12717696225"
};
firebase.initializeApp(config);
// TODO - actually handle errors
firebase.auth().signInAnonymously().catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
});
// boot app once firebase has finished initializing
let app;
firebase.auth().onAuthStateChanged(function(user){
const data = {};
data.current = {};
data.current.user = user;
console.dir({'data': data});
console.dir({'user': user});
if(!app){
/* eslint-disable no-new */
app = new Vue({
el: '#app',
router,
components: { App },
template: '<App/>',
data: data
})
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment