mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-29 18:36:34 -05:00
11 lines
273 B
TypeScript
11 lines
273 B
TypeScript
import { authClient } from "~/lib/auth-client";
|
|
|
|
export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
const { data: session } = await authClient.useSession(useFetch);
|
|
if (!session.value) {
|
|
if (to.path === "/dashboard") {
|
|
return navigateTo("/");
|
|
}
|
|
}
|
|
});
|