diff --git a/src/runtime/middleware/auth.ts b/src/runtime/middleware/auth.ts index 06a06537..ca2be659 100644 --- a/src/runtime/middleware/auth.ts +++ b/src/runtime/middleware/auth.ts @@ -75,5 +75,9 @@ export default defineNuxtRouteMiddleware((to) => { const signInOptions: Parameters[1] = { error: 'SessionRequired', callbackUrl: determineCallbackUrl(authConfig, () => to.path) } // @ts-ignore This is valid for a backend-type of `authjs`, where sign-in accepts a provider as a first argument return signIn(undefined, signInOptions) as ReturnType - } else if (typeof metaAuth === 'object' && metaAuth.navigateUnauthenticatedTo) { return navigateTo(metaAuth.navigateUnauthenticatedTo) } else { return navigateTo(authConfig.provider.pages.login) } + } else if (typeof metaAuth === 'object' && metaAuth.navigateUnauthenticatedTo) { + return navigateTo(metaAuth.navigateUnauthenticatedTo) + } else { + return navigateTo(authConfig.provider.pages.login) + } })