Skip to content

Instantly share code, notes, and snippets.

@kevinbreaker
Created May 20, 2018 01:36
Show Gist options
  • Save kevinbreaker/be5a4fb7c05b6da4e2d63328c1178451 to your computer and use it in GitHub Desktop.
Save kevinbreaker/be5a4fb7c05b6da4e2d63328c1178451 to your computer and use it in GitHub Desktop.
Usando firebase no quasar 0.15
// ##### Este arquivo deverá ficar dentro de src/plugins/ #####
import firebase from 'firebase'
// Aqui você cola a configuração que o firebase te fornece
const config = {
apiKey: '#',
authDomain: '#',
databaseURL: '#',
projectId: '#',
storageBucket: '#',
messagingSenderId: '#'
}
export const fireB = firebase.initializeApp(config)
export const AUTH = fireB.auth()
export const DB = fireB.database()
export default ({ app, router, Vue }) => {
Vue.prototype.$auth = AUTH // Dentro de seus componentes você tem tem acesso através do this.$auth
Vue.prototype.$db = DB // Dentro de seus componentes você tem tem acesso através do this.$db
}
module.exports = function (ctx) {
return {
// app plugins (/src/plugins)
plugins: [
'firebase' // ###### Para estar funcionando em sua aplicação, você apenas coloca o nome que você deu ao seu arquivo de plugin e tudo pronto.
],
css: [
'app.styl'
],
extras: [
ctx.theme.mat ? 'roboto-font' : null,
'material-icons'
],
supportIE: false,
vendor: {
add: [],
remove: []
},
build: {
scopeHoisting: true,
vueRouterMode: 'history',
extendWebpack (cfg) {
cfg.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules|quasar)/
})
}
},
devServer: {
open: false // opens browser window automatically
},
// framework: 'all' --- includes everything; for dev only!
framework: {
components: [
],
directives: [
],
// Quasar plugins
plugins: [
]
},
// animations: 'all' --- includes all animations
animations: [
],
pwa: {
},
cordova: {
// id: 'org.cordova.quasar.app'
},
electron: {
extendWebpack (cfg) {
// do something with cfg
},
packager: {
}
},
// leave this here for Quasar CLI
starterKit: '1.0.3'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment