mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
13 lines
316 B
TypeScript
13 lines
316 B
TypeScript
export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
if (import.meta.server) return
|
|
|
|
const { $authClient } = useNuxtApp()
|
|
const session = $authClient.useSession()
|
|
|
|
if (session.value.isPending || !session.value) {
|
|
if (to.path === "/dashboard") {
|
|
return navigateTo("/login");
|
|
}
|
|
}
|
|
});
|