aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/layout/IfLoggedIn.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'webui/src/layout/IfLoggedIn.tsx')
-rw-r--r--webui/src/layout/IfLoggedIn.tsx14
1 files changed, 14 insertions, 0 deletions
diff --git a/webui/src/layout/IfLoggedIn.tsx b/webui/src/layout/IfLoggedIn.tsx
new file mode 100644
index 00000000..8b9058dc
--- /dev/null
+++ b/webui/src/layout/IfLoggedIn.tsx
@@ -0,0 +1,14 @@
+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;