blob: 965135d90698fe8bfba721d0337b1e7681aee9cf (
plain) (
tree)
|
|
import * as React from 'react';
import { useCurrentIdentityQuery } from '../Identity/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;
|