* Create a global appMachine
* Strip authMachine of side-effects
* Replace react-bound authMachine use with XState actor use
* Fix import goof
* Register auth commands directly!
* @lf94 feedback: conver `AuthNavigationHandler` to `useAuthNavigation`
* Uh, fix signing out thank you @lf94
* Fix tsc
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)"
This reverts commit 8dc50b6a26
.
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
17 lines
472 B
TypeScript
17 lines
472 B
TypeScript
import { useAuthState } from 'machines/appMachine'
|
|
import Loading from './components/Loading'
|
|
|
|
// Wrapper around protected routes, used in src/Router.tsx
|
|
export const Auth = ({ children }: React.PropsWithChildren) => {
|
|
const authState = useAuthState()
|
|
const isLoggingIn = authState.matches('checkIfLoggedIn')
|
|
|
|
return isLoggingIn ? (
|
|
<Loading>
|
|
<span data-testid="initial-load">Loading Modeling App...</span>
|
|
</Loading>
|
|
) : (
|
|
<>{children}</>
|
|
)
|
|
}
|