From beb621ace4d4b032caa0b7f51e728dd9d63cdb84 Mon Sep 17 00:00:00 2001 From: Louis Haftmann <30736553+LouisHaftmann@users.noreply.github.com> Date: Fri, 11 Aug 2023 07:54:13 +0200 Subject: [PATCH] feat: add 'unauthenticatedOnly' default value --- src/runtime/middleware/auth.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/runtime/middleware/auth.ts b/src/runtime/middleware/auth.ts index ca2be659..db4eb8d3 100644 --- a/src/runtime/middleware/auth.ts +++ b/src/runtime/middleware/auth.ts @@ -29,7 +29,13 @@ declare module '#app/../pages/runtime/composables' { } export default defineNuxtRouteMiddleware((to) => { - const metaAuth = to.meta.auth + const metaAuth = typeof to.meta.auth === 'object' + ? { + unauthenticatedOnly: true, + ...to.meta.auth + } + : to.meta.auth + if (metaAuth === false) { return }