Last active
June 12, 2018 19:18
-
-
Save elcferreira/19821681a196cd2af14652bf1169c510 to your computer and use it in GitHub Desktop.
Flamelink and nuxtjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
import firebase from 'firebase' | |
// import * as firebase from 'firebase'; | |
import Flamelink from 'flamelink' | |
const Plugin = { | |
install: (Vue, options) => { | |
let firebaseApp | |
if(firebase.apps && firebase.apps.length > 0) { | |
firebaseApp = firebase.apps[0] | |
} else { | |
firebaseApp = firebase.initializeApp({ | |
apiKey: "apikey", | |
authDomain: "authdomain", | |
databaseURL: "database", | |
projectId: "projectId", | |
storageBucket: "storage", | |
messagingSenderId: "messaging" | |
}) | |
} | |
Vue.prototype.$flamelink = Flamelink({ firebaseApp }) | |
} | |
} | |
Vue.use(Plugin) | |
export default (ctx) => { | |
const { app, store } = ctx | |
app.$flamelink = Vue.prototype.$flamelink | |
ctx.$flamelink = Vue.prototype.$flamelink | |
if (store) { | |
store.$flamelink = Vue.prototype.$flamelink | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
plugins: [ | |
'~/plugins/flamelink' | |
], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment