Integrate Firestore database

This commit is contained in:
2022-10-19 21:10:49 +02:00
parent e582a1ab41
commit da9f105825
5 changed files with 72 additions and 19 deletions

View File

@@ -1,5 +1,6 @@
import { initializeApp } from 'firebase/app'
import { getAuth } from 'firebase/auth'
import { getFirestore } from 'firebase/firestore'
// Firebase configuration
const firebaseConfig = {
@@ -17,8 +18,12 @@ const app = initializeApp(firebaseConfig)
// Initialize Firebase Authentication and get a reference to the service
const auth = getAuth(app)
// Initialize Cloud Firestore and get a reference to the service
const db = getFirestore(app)
export default ({ app }, inject) => {
// Inject $auth in Vue, context and store.
// Inject $auth and $db in Vue, context and store.
// Ref: https://nuxtjs.org/docs/directory-structure/plugins/
inject('auth', auth)
inject('db', db)
}