NuxtN
Nuxt11mo ago
4 replies
_Lex

stuck whit the nuxt-auth-utils useUserSession

every time i change import or anything i get new errors i cant seem to find where to look or what to change to get it to work

import { defineNuxtRouteMiddleware, navigateTo } from 'nuxt/app'
import  { useUserSession }  from 'nuxt-auth-utils'; // Correcte import

export default defineNuxtRouteMiddleware(() => {
    const { loggedIn } = useUserSession()
  
    // redirect the user to the login screen if they're not authenticated
    if (!loggedIn.value) {
      return navigateTo('/login')
    }
})
`
Was this page helpful?