first commit

This commit is contained in:
lendry
2026-06-24 14:37:15 +03:00
commit 995adeedd4
188 changed files with 28810 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
'use client';
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { useAuth } from '@/components/id/auth-provider';
export default function AdminLayout({ children }: { children: React.ReactNode }) {
const router = useRouter();
const { user, isLoading, isPinLocked, hasStoredSession } = useAuth();
useEffect(() => {
if (isLoading) return;
if (!user && !isPinLocked && !hasStoredSession) {
router.replace('/auth/login');
return;
}
if (user && !user.canAccessAdmin) {
router.replace('/');
}
}, [hasStoredSession, isLoading, isPinLocked, router, user]);
return children;
}