mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-11 04:19:31 +00: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("/");
|
|
}
|
|
}
|
|
});
|