chore(site): rename userXService to authXService (#924)

* chore(site): rename userXService to authXService

* Rename contents of xService
This commit is contained in:
Presley Pizzo
2022-04-08 11:42:57 -04:00
committed by GitHub
parent 94ab6f3d8e
commit 0bf9dee7e3
6 changed files with 34 additions and 34 deletions
+3 -3
View File
@@ -5,9 +5,9 @@ import { NavbarView } from "./NavbarView"
export const Navbar: React.FC = () => {
const xServices = useContext(XServiceContext)
const [userState, userSend] = useActor(xServices.userXService)
const { me } = userState.context
const onSignOut = () => userSend("SIGN_OUT")
const [authState, authSend] = useActor(xServices.authXService)
const { me } = authState.context
const onSignOut = () => authSend("SIGN_OUT")
return <NavbarView user={me} onSignOut={onSignOut} />
}
+3 -3
View File
@@ -11,13 +11,13 @@ export interface RequireAuthProps {
export const RequireAuth: React.FC<RequireAuthProps> = ({ children }) => {
const xServices = useContext(XServiceContext)
const [userState] = useActor(xServices.userXService)
const [authState] = useActor(xServices.authXService)
const location = useLocation()
const redirectTo = embedRedirect(location.pathname)
if (userState.matches("signedOut") || !userState.context.me) {
if (authState.matches("signedOut") || !authState.context.me) {
return <Navigate to={redirectTo} />
} else if (userState.hasTag("loading")) {
} else if (authState.hasTag("loading")) {
return <FullScreenLoader />
} else {
return children