@sbusso/vca-firebase
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

Vue Firebase Composition Api

Powered by Vite

Usage

<template>
  <div>UID: {{ uid }}</div>
  <pre>{{ accounts }}</pre>
  <button @click="signInWithGoogle">Sign In with Google</button>
  <button @click="createAccount({ name: 'Join' })">Add</button>
</template>

<script>
  import { initFirebase, useAuth, useCollection, useDoc } from 'vca-firebase'
  import firebaseConfig from './firebase.config.js'

  export default {
    setup() {
      initFirebase(firebase, firebaseConfig)

      const { uid, signInWithGoogle } = useAuth()
      const { docs: accounts } = useCollection('accounts')
      const { create: createAccount } = useDoc('accounts')

      return {
        signInWithGoogle,
        uid,
        accounts,
        createAccount,
      }
    },
  }
</script>

Setup

yarn create vite-app test-vca-firebase
cd test-vca-firebase
yarn add firebase
yarn add vca-firebase

Create firebase.config.js:

  • Generate config object in Firebase Console.
  • Enable/disable plugins, i.e. analytics.
export default {
  config: {
    apiKey,
    authDomain,
    databaseURL,
    projectId,
    storageBucket,
    messagingSenderId,
    appId,
    measurementId,
  },
  analytics: false,
}

Development

Setup project and run:

yarn dev

See the power of Vite! Project is available in less than 1 second!

Readme

Keywords

none

Package Sidebar

Install

npm i @sbusso/vca-firebase

Weekly Downloads

1

Version

0.0.8

License

MIT

Unpacked Size

15.3 kB

Total Files

12

Last publish

Collaborators

  • sbusso