🛂 Auth guard

This commit is contained in:
2024-08-12 23:51:42 +08:00
parent 6162f8f891
commit 1130e6a574
9 changed files with 33 additions and 38 deletions

7
middleware/auth.ts Normal file
View File

@@ -0,0 +1,7 @@
export default defineNuxtRouteMiddleware((to, from) => {
const state = useLoggedInState();
if (!state.value) {
return navigateTo(`/auth/sign-in?redirect_uri=${to.fullPath}`)
}
})