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'
5
5
import { type FirebaseOptions } from '@firebase/app-types'
6
6
7
7
export 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'
9
14
10
15
config : FirebaseOptions
11
16
/**
@@ -39,11 +44,9 @@ const VueFireModule: NuxtModule<VueFireNuxtModuleOptions> =
39
44
40
45
setup ( options , nuxt ) {
41
46
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' ) )
47
50
} ,
48
51
} )
49
52
Original file line number Diff line number Diff line change 1
1
import { usePendingPromises , VueFire , useSSRInitialState } from 'vuefire'
2
2
import { initializeApp } from 'firebase/app'
3
- import { defineNuxtPlugin } from '#imports'
3
+ import { defineNuxtPlugin , useAppConfig } from '#imports'
4
4
5
5
export default defineNuxtPlugin ( async ( nuxtApp ) => {
6
6
// TODO: initialize firebase app from config
7
+ console . log ( 'appconfig' , useAppConfig ( ) )
7
8
const firebaseApp = initializeApp ( )
8
9
9
10
nuxtApp . vueApp . use (
@@ -15,20 +16,12 @@ export default defineNuxtPlugin(async (nuxtApp) => {
15
16
)
16
17
17
18
if ( process . server ) {
18
- await usePendingPromises ( )
19
19
// TODO: pass the firebaseApp
20
- nuxtApp . payload . vuefire = useSSRInitialState ( )
20
+ nuxtApp . payload . vuefire = useSSRInitialState ( undefined , firebaseApp )
21
21
} else if ( nuxtApp . payload ?. vuefire ) {
22
22
// hydrate the plugin state from nuxtApp.payload.vuefire
23
- useSSRInitialState ( nuxtApp . payload . vuefire )
23
+ useSSRInitialState ( nuxtApp . payload . vuefire , firebaseApp )
24
24
}
25
25
26
- return {
27
- provide : {
28
- // firebaseApp:
29
- // firestore
30
- // database
31
- // auth
32
- } ,
33
- }
26
+ return { }
34
27
} )
You can’t perform that action at this time.
0 commit comments