Denis Jankelaic
Denis Jankelaic
NNuxt
Created by Denis Jankelaic on 7/30/2024 in #❓・help
Middlewares no longer work.
Since we upgraded from 3.11.2 to 3.12.4 middlewares are no longer loading up.
definePageMeta({
middleware: 'auth',
})
definePageMeta({
middleware: 'auth',
})
Is there a new way to implement this? file is middleware/auth.ts
import { Routes } from '~/enums/Routes'
import QueryEnum from '~/enums/QueryEnum'
import getLocalizedRoute from '~/utils/getLocalizedRoute'

export default defineNuxtRouteMiddleware(async (_to, from) => {
const loggedIn = await useCurrentUser().isLoggedIn()

if (!loggedIn) {
return navigateTo(
getLocalizedRoute(
Routes.Login,
{},
{
[QueryEnum.Redirect]: from.fullPath,
}
)
)
}
})
import { Routes } from '~/enums/Routes'
import QueryEnum from '~/enums/QueryEnum'
import getLocalizedRoute from '~/utils/getLocalizedRoute'

export default defineNuxtRouteMiddleware(async (_to, from) => {
const loggedIn = await useCurrentUser().isLoggedIn()

if (!loggedIn) {
return navigateTo(
getLocalizedRoute(
Routes.Login,
{},
{
[QueryEnum.Redirect]: from.fullPath,
}
)
)
}
})
4 replies
NNuxt
Created by Denis Jankelaic on 4/9/2024 in #❓・help
Partytown + Nuxt3
No description
2 replies
NNuxt
Created by Denis Jankelaic on 3/21/2024 in #❓・help
Memory leaks since 3.9.0 version.
No description
11 replies
NNuxt
Created by Denis Jankelaic on 3/20/2024 in #❓・help
⚠ Invalid regular expression: invalid group specifier name
No description
2 replies