Skip to content

Commit a8c043f

Browse files
committed
wip(nuxt): auth plugin
1 parent a7571eb commit a8c043f

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

packages/nuxt/src/module.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ const VueFire: NuxtModule<VueFireNuxtModuleOptions> =
113113
}
114114

115115
nuxt.hook('modules:done', () => {
116+
addPlugin(resolve(runtimeDir, 'plugins/admin.server'))
117+
118+
addPlugin(resolve(runtimeDir, 'plugins/auth.client'))
119+
116120
// plugin are added in reverse order
117121
addPluginTemplate({
118122
src: normalize(resolve(templatesDir, 'plugin.ejs')),
@@ -122,7 +126,6 @@ const VueFire: NuxtModule<VueFireNuxtModuleOptions> =
122126
ssr: nuxt.options.ssr,
123127
},
124128
})
125-
addPlugin(resolve(runtimeDir, 'plugins/admin.server'))
126129
addPlugin(resolve(runtimeDir, 'plugins/app'))
127130
})
128131
},
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { FirebaseApp } from '@firebase/app-types'
2+
import { VueFireAuth } from 'vuefire'
3+
import { defineNuxtPlugin } from '#app'
4+
5+
/**
6+
* Initializes the app and provides it to others.
7+
*/
8+
9+
export default defineNuxtPlugin((nuxtApp) => {
10+
const firebaseApp = nuxtApp.$firebaseApp as FirebaseApp
11+
12+
VueFireAuth()(firebaseApp, nuxtApp.vueApp)
13+
})

packages/nuxt/templates/plugin.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default defineNuxtPlugin((nuxtApp) => {
4343
const modules = []
4444

4545
<% if(options.auth) { %>
46-
// Auth
46+
// modules.push(VueFireAuth())
4747
<% } %>
4848

4949
<% if(options.appCheck) { %>

0 commit comments

Comments
 (0)