Files
modeling-app/src/Auth.tsx

14 lines
414 B
TypeScript
Raw Normal View History

import Loading from './components/Loading'
import { useAuthMachine } from './hooks/useAuthMachine'
2023-07-27 18:59:40 -04:00
// Wrapper around protected routes, used in src/Router.tsx
export const Auth = ({ children }: React.PropsWithChildren) => {
const [isLoggedIn] = useAuthMachine((s) => s.matches('checkIfLoggedIn'))
2023-07-11 20:34:09 +10:00
return isLoggedIn ? (
<Loading>Loading KittyCAD Modeling App...</Loading>
) : (
<>{children}</>
)
}