mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-14 05:24:04 +00:00
11 lines
322 B
TypeScript
11 lines
322 B
TypeScript
|
import { PropsWithChildren, ReactNode } from 'react';
|
||
|
import { auth } from '@sd/client';
|
||
|
|
||
|
export function AuthCheck({ fallback, children }: PropsWithChildren<{ fallback?: ReactNode }>) {
|
||
|
const authState = auth.useStateSnapshot();
|
||
|
|
||
|
if (authState.status !== 'loggedIn') return <>{fallback}</>;
|
||
|
|
||
|
return <>{children}</>;
|
||
|
}
|