File tree 4 files changed +12
-7
lines changed
packages/nuxt/src/runtime
4 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 1
1
import { App as AdminApp } from 'firebase-admin/app'
2
- import { getAdminApp } from 'vuefire/server'
2
+ import { ensureAdminApp } from 'vuefire/server'
3
3
import { defineNuxtPlugin , useRequestEvent , useRuntimeConfig } from '#app'
4
4
5
5
export default defineNuxtPlugin ( ( ) => {
6
6
const event = useRequestEvent ( )
7
7
const { vuefire } = useRuntimeConfig ( )
8
8
9
- const firebaseAdminApp = getAdminApp ( vuefire ?. options ?. admin ?. options )
9
+ const firebaseAdminApp = ensureAdminApp ( vuefire ?. options ?. admin ?. options )
10
10
11
11
// TODO: Is this accessible within middlewares and api routes? or should we use a middleware to add it
12
12
event . context . firebaseApp = firebaseAdminApp
Original file line number Diff line number Diff line change 7
7
deleteCookie ,
8
8
setResponseStatus ,
9
9
} from 'h3'
10
- import { getAdminApp } from 'vuefire/server'
10
+ import { ensureAdminApp } from 'vuefire/server'
11
11
import { logger } from '../logging'
12
12
import { useRuntimeConfig } from '#imports'
13
13
@@ -19,7 +19,7 @@ export default defineEventHandler(async (event) => {
19
19
const { token } = await readBody < { token ?: string } > ( event )
20
20
const { vuefire } = useRuntimeConfig ( )
21
21
22
- const adminApp = getAdminApp (
22
+ const adminApp = ensureAdminApp (
23
23
{
24
24
projectId : vuefire ?. options ?. config ?. projectId ,
25
25
...vuefire ?. options ?. admin ?. options ,
Original file line number Diff line number Diff line change @@ -12,13 +12,13 @@ import { logger } from './logging'
12
12
const FIREBASE_ADMIN_APP_NAME = 'vuefire-admin'
13
13
14
14
/**
15
- * Setups a Firebase Admin App
15
+ * Setups a Firebase Admin App or reuses it
16
16
*
17
17
* @param firebaseAdminOptions - options to pass to the admin app
18
18
* @param name - name of the app
19
19
* @experimental this is experimental and may change in the future
20
20
*/
21
- export function getAdminApp (
21
+ export function ensureAdminApp (
22
22
firebaseAdminOptions ?: Omit < AppOptions , 'credential' > ,
23
23
name = FIREBASE_ADMIN_APP_NAME
24
24
) {
Original file line number Diff line number Diff line change
1
+ import { ensureAdminApp } from './admin'
1
2
export { VueFireAppCheckServer } from './app-check'
2
3
export {
3
4
VueFireAuthServer ,
6
7
decodeSessionCookie ,
7
8
decodeUserToken ,
8
9
} from './auth'
9
- export { getAdminApp } from './admin'
10
+ export { ensureAdminApp } from './admin'
11
+ /**
12
+ * @deprecated use `ensureAdminApp` instead.
13
+ */
14
+ export const getAdminApp = ensureAdminApp
10
15
export { isFirebaseError } from './utils'
You can’t perform that action at this time.
0 commit comments