blob: 2476aad87cd4589bfaf4d05f9a34be107227f69c (
plain) (
tree)
|
|
import React from 'react';
import { useCurrentIdentityQuery } from '../CurrentIdentity/CurrentIdentity.generated';
type Props = { children: () => React.ReactNode };
const IfLoggedIn = ({ children }: Props) => {
const { loading, error, data } = useCurrentIdentityQuery();
if (error || loading || !data?.repository?.userIdentity) return null;
return <>{children()}</>;
};
export default IfLoggedIn;
|