import { type ReactNode } from 'react'
import { Navigate, useLocation } from 'react-router-dom'
import { useAuth } from '../contexts/AuthContext'
import { PageLoader } from './PageLoader'
type Props = {
children: ReactNode
}
export function ProtectedRoute({ children }: Props) {
const { user, loading } = useAuth()
const location = useLocation()
if (loading) {
return
}
if (!user) {
return
}
return <>{children}>
}