Files
modeling-app/src/Auth.tsx

17 lines
468 B
TypeScript
Raw Normal View History

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