import { Navigate } from 'react-router-dom'
import { useAuthStore } from '../../store'
export function RequireAuth({ children }) {
const { isAuthenticated } = useAuthStore()
if (!isAuthenticated) return
return children
}
export function RequireAdmin({ children }) {
const { isAuthenticated, user } = useAuthStore()
if (!isAuthenticated) return
if (user?.role !== 'admin') return
return children
}