File tree Expand file tree Collapse file tree 2 files changed +14
-18
lines changed Expand file tree Collapse file tree 2 files changed +14
-18
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,12 @@ import { type NuxtModule } from '@nuxt/schema'
55import { type FirebaseOptions } from '@firebase/app-types'
66
77export interface VueFireNuxtModuleOptions {
8- optionsApiPlugin : boolean
8+ /**
9+ * Should we add the `VueFireFirestoreOptionsAPI` and `VueFireRealtimeDatabaseOptionsAPI` modules?. Pass `true` to add
10+ * both, or `'firestore'` or `'realtime-database'` to add only one. Pass false to disable.
11+ * @default false
12+ */
13+ optionsApiPlugin ?: boolean | 'firestore' | 'database'
914
1015 config : FirebaseOptions
1116 /**
@@ -39,11 +44,9 @@ const VueFireModule: NuxtModule<VueFireNuxtModuleOptions> =
3944
4045 setup ( options , nuxt ) {
4146 const runtimeDir = fileURLToPath ( new URL ( './runtime' , import . meta. url ) )
42- if ( options . optionsApiPlugin ) {
43- nuxt . options . build . transpile . push ( runtimeDir )
44- // TODO: check for individual options
45- addPlugin ( resolve ( runtimeDir , 'plugin' ) )
46- }
47+ nuxt . options . build . transpile . push ( runtimeDir )
48+ // TODO: check for individual options
49+ addPlugin ( resolve ( runtimeDir , 'plugin' ) )
4750 } ,
4851 } )
4952
Original file line number Diff line number Diff line change 11import { usePendingPromises , VueFire , useSSRInitialState } from 'vuefire'
22import { initializeApp } from 'firebase/app'
3- import { defineNuxtPlugin } from '#imports'
3+ import { defineNuxtPlugin , useAppConfig } from '#imports'
44
55export default defineNuxtPlugin ( async ( nuxtApp ) => {
66 // TODO: initialize firebase app from config
7+ console . log ( 'appconfig' , useAppConfig ( ) )
78 const firebaseApp = initializeApp ( )
89
910 nuxtApp . vueApp . use (
@@ -15,20 +16,12 @@ export default defineNuxtPlugin(async (nuxtApp) => {
1516 )
1617
1718 if ( process . server ) {
18- await usePendingPromises ( )
1919 // TODO: pass the firebaseApp
20- nuxtApp . payload . vuefire = useSSRInitialState ( )
20+ nuxtApp . payload . vuefire = useSSRInitialState ( undefined , firebaseApp )
2121 } else if ( nuxtApp . payload ?. vuefire ) {
2222 // hydrate the plugin state from nuxtApp.payload.vuefire
23- useSSRInitialState ( nuxtApp . payload . vuefire )
23+ useSSRInitialState ( nuxtApp . payload . vuefire , firebaseApp )
2424 }
2525
26- return {
27- provide : {
28- // firebaseApp:
29- // firestore
30- // database
31- // auth
32- } ,
33- }
26+ return { }
3427} )
You can’t perform that action at this time.
0 commit comments