rebuild app as turbopack-first single-stack with internal api and openclaw tasks
This commit is contained in:
@@ -1,22 +1,16 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useSession } from '@/lib/better-auth';
|
||||
|
||||
export function useAuthGuard() {
|
||||
const { data: session, isPending } = useSession();
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
if (!isPending && !session) {
|
||||
router.replace('/auth/signin');
|
||||
}
|
||||
}, [isPending, session, router]);
|
||||
|
||||
return {
|
||||
session,
|
||||
isPending,
|
||||
isAuthenticated: Boolean(session?.user)
|
||||
session: {
|
||||
user: {
|
||||
id: 1,
|
||||
name: 'Local Operator',
|
||||
email: 'operator@local.fiscal',
|
||||
image: null
|
||||
}
|
||||
},
|
||||
isPending: false,
|
||||
isAuthenticated: true
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user