UNPKG

create-better-t-stack

Version:

A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations

13 lines (10 loc) 316 B
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"); } } });