File tree Expand file tree Collapse file tree 4 files changed +12
-7
lines changed
packages/nuxt/src/runtime Expand file tree Collapse file tree 4 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 11import { App as AdminApp } from 'firebase-admin/app'
2- import { getAdminApp } from 'vuefire/server'
2+ import { ensureAdminApp } from 'vuefire/server'
33import { defineNuxtPlugin , useRequestEvent , useRuntimeConfig } from '#app'
44
55export default defineNuxtPlugin ( ( ) => {
66 const event = useRequestEvent ( )
77 const { vuefire } = useRuntimeConfig ( )
88
9- const firebaseAdminApp = getAdminApp ( vuefire ?. options ?. admin ?. options )
9+ const firebaseAdminApp = ensureAdminApp ( vuefire ?. options ?. admin ?. options )
1010
1111 // TODO: Is this accessible within middlewares and api routes? or should we use a middleware to add it
1212 event . context . firebaseApp = firebaseAdminApp
Original file line number Diff line number Diff line change 77 deleteCookie ,
88 setResponseStatus ,
99} from 'h3'
10- import { getAdminApp } from 'vuefire/server'
10+ import { ensureAdminApp } from 'vuefire/server'
1111import { logger } from '../logging'
1212import { useRuntimeConfig } from '#imports'
1313
@@ -19,7 +19,7 @@ export default defineEventHandler(async (event) => {
1919 const { token } = await readBody < { token ?: string } > ( event )
2020 const { vuefire } = useRuntimeConfig ( )
2121
22- const adminApp = getAdminApp (
22+ const adminApp = ensureAdminApp (
2323 {
2424 projectId : vuefire ?. options ?. config ?. projectId ,
2525 ...vuefire ?. options ?. admin ?. options ,
Original file line number Diff line number Diff line change @@ -12,13 +12,13 @@ import { logger } from './logging'
1212const FIREBASE_ADMIN_APP_NAME = 'vuefire-admin'
1313
1414/**
15- * Setups a Firebase Admin App
15+ * Setups a Firebase Admin App or reuses it
1616 *
1717 * @param firebaseAdminOptions - options to pass to the admin app
1818 * @param name - name of the app
1919 * @experimental this is experimental and may change in the future
2020 */
21- export function getAdminApp (
21+ export function ensureAdminApp (
2222 firebaseAdminOptions ?: Omit < AppOptions , 'credential' > ,
2323 name = FIREBASE_ADMIN_APP_NAME
2424) {
Original file line number Diff line number Diff line change 1+ import { ensureAdminApp } from './admin'
12export { VueFireAppCheckServer } from './app-check'
23export {
34 VueFireAuthServer ,
67 decodeSessionCookie ,
78 decodeUserToken ,
89} from './auth'
9- export { getAdminApp } from './admin'
10+ export { ensureAdminApp } from './admin'
11+ /**
12+ * @deprecated use `ensureAdminApp` instead.
13+ */
14+ export const getAdminApp = ensureAdminApp
1015export { isFirebaseError } from './utils'
You can’t perform that action at this time.
0 commit comments