feat: auth middleware
This commit is contained in:
6
wp-content/themes/moonshine/app/middleware/isLoggedIn.ts
Normal file
6
wp-content/themes/moonshine/app/middleware/isLoggedIn.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export default defineNuxtRouteMiddleware((to) => {
|
||||
const { isLoggedIn } = useAuth();
|
||||
if (!isLoggedIn.value) {
|
||||
return navigateTo({ path: "/connexion", query: { redirect: to.fullPath } });
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user