I'm trying to use VueFire's useCurrentUser() function in a Nuxt 3 application without SSR.
I have configured vuefire in nuxt.config.ts as indicated in the documentation.
export default defineNuxtConfig({
modules: ['nuxt-vuefire',],
vuefire: {
config: {
apiKey: '...',
authDomain: '...',
projectId: '...',
appId: '...',
},
},
})
Then in app.vue I use the code as in the documentation:
<script setup>
const router = useRouter()
const route = useRoute()
const user = useCurrentUser()
onMounted(() => {
watch(user, (user, prevUser) => {
if (prevUser && !user) {
// user logged out
router.push('/login')
} else if (user && typeof route.query.redirect === 'string') {
// user logged in
router.push(route.query.redirect)
}
})
})
</script>
Unfortunately, it always gives me the error:
**
[VueFire] useCurrentUser() called before the VueFireAuth module was added to the VueFire plugin. This will fail in production.
**
Thank you in advance for your help