blob: 9f4a75767051f30dbf44aca6ea0e62615a048bc5 (
plain) (
tree)
|
|
import React from 'react';
import { useCurrentIdentityQuery } from './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;
|