From 343ba24246622889f51e90fd5bf86c3a38c8a4bb Mon Sep 17 00:00:00 2001 From: Rihan Date: Tue, 6 Jun 2023 01:41:52 +0000 Subject: [PATCH] feat: :sparkles: Begin auth middleware --- middleware/auth.global.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 middleware/auth.global.ts diff --git a/middleware/auth.global.ts b/middleware/auth.global.ts new file mode 100644 index 0000000..851dc4c --- /dev/null +++ b/middleware/auth.global.ts @@ -0,0 +1,9 @@ +export default defineNuxtRouteMiddleware((to, from) => { + const IS_LOGGED_IN = true; + + // TODO: exclude routes that don't require authentication + + if (!IS_LOGGED_IN) { + return navigateTo("/login"); + } +});