UNPKG

nuxt-users

Version:

A comprehensive user management module for Nuxt 3 and Nuxt 4 applications with authentication, authorization, database support, and CLI tools

17 lines (16 loc) 425 B
import { defineNuxtPlugin } from "#app"; import { useAuthentication } from "./composables/useAuthentication.js"; export default defineNuxtPlugin(async () => { if (import.meta.server) { const { fetchUser } = useAuthentication(); try { await fetchUser(true); } catch { } return; } if (import.meta.client) { const { initializeUser } = useAuthentication(); await initializeUser(); } });