import { usePage } from '@inertiajs/react'; import type { Auth, InertiaPage } from '~/types/inertia'; export const useAuth = () => usePage().props.auth; export const withAuth = ( Component: React.ComponentType ): React.ComponentType> => { return (props: Omit) => { const auth = useAuth(); return ; }; }; export const withAuthRequired = ( Component: React.ComponentType ): React.ComponentType> => { return (props: Omit) => { const auth = useAuth(); if (!auth.isAuthenticated) { return null; } return ; }; };