({ children, fallback }: React.PropsWithChildren<{ fallback: JSX.Element }>)
| 13 | } |
| 14 | |
| 15 | export const AuthWrapper = ({ children, fallback }: React.PropsWithChildren<{ fallback: JSX.Element }>): JSX.Element => { |
| 16 | const { status, data: signInCheckResult } = useSigninCheck(); |
| 17 | |
| 18 | if (!children) { |
| 19 | throw new Error('Children must be provided'); |
| 20 | } |
| 21 | if (status === 'loading') { |
| 22 | return <LoadingSpinner />; |
| 23 | } else if (signInCheckResult.signedIn === true) { |
| 24 | return children as JSX.Element; |
| 25 | } |
| 26 | |
| 27 | return fallback; |
| 28 | }; |
| 29 | |
| 30 | const UserDetails = ({ user }) => { |
| 31 | const auth = useAuth(); |
nothing calls this directly
no test coverage detected