Skip to content

Commit ae19e37

Browse files
committed
chore(site): rename userXService to authXService
1 parent 94ab6f3 commit ae19e37

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

site/src/components/Navbar/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { NavbarView } from "./NavbarView"
55

66
export const Navbar: React.FC = () => {
77
const xServices = useContext(XServiceContext)
8-
const [userState, userSend] = useActor(xServices.userXService)
9-
const { me } = userState.context
10-
const onSignOut = () => userSend("SIGN_OUT")
8+
const [authState, authSend] = useActor(xServices.authXService)
9+
const { me } = authState.context
10+
const onSignOut = () => authSend("SIGN_OUT")
1111

1212
return <NavbarView user={me} onSignOut={onSignOut} />
1313
}

site/src/components/Page/RequireAuth.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ export interface RequireAuthProps {
1111

1212
export const RequireAuth: React.FC<RequireAuthProps> = ({ children }) => {
1313
const xServices = useContext(XServiceContext)
14-
const [userState] = useActor(xServices.userXService)
14+
const [authState] = useActor(xServices.authXService)
1515
const location = useLocation()
1616
const redirectTo = embedRedirect(location.pathname)
1717

18-
if (userState.matches("signedOut") || !userState.context.me) {
18+
if (authState.matches("signedOut") || !authState.context.me) {
1919
return <Navigate to={redirectTo} />
20-
} else if (userState.hasTag("loading")) {
20+
} else if (authState.hasTag("loading")) {
2121
return <FullScreenLoader />
2222
} else {
2323
return children

site/src/pages/cli-auth.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { XServiceContext } from "../xServices/StateContext"
88

99
export const CliAuthenticationPage: React.FC = () => {
1010
const xServices = useContext(XServiceContext)
11-
const [userState] = useActor(xServices.userXService)
12-
const { me } = userState.context
11+
const [authState] = useActor(xServices.authXService)
12+
const { me } = authState.context
1313

1414
const styles = useStyles()
1515

site/src/pages/login.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ export const SignInPage: React.FC = () => {
2424
const styles = useStyles()
2525
const location = useLocation()
2626
const xServices = useContext(XServiceContext)
27-
const [userState, userSend] = useActor(xServices.userXService)
28-
const isLoading = userState.hasTag("loading")
27+
const [authState, authSend] = useActor(xServices.authXService)
28+
const isLoading = authState.hasTag("loading")
2929
const redirectTo = retrieveRedirect(location.search)
30-
const authErrorMessage = userState.context.authError ? (userState.context.authError as Error).message : undefined
30+
const authErrorMessage = authState.context.authError ? (authState.context.authError as Error).message : undefined
3131

3232
const onSubmit = async ({ email, password }: { email: string; password: string }) => {
33-
userSend({ type: "SIGN_IN", email, password })
33+
authSend({ type: "SIGN_IN", email, password })
3434
}
3535

36-
if (userState.matches("signedIn")) {
36+
if (authState.matches("signedIn")) {
3737
return <Navigate to={redirectTo} replace />
3838
} else {
3939
return (

site/src/xServices/StateContext.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { useInterpret } from "@xstate/react"
22
import React, { createContext } from "react"
33
import { ActorRefFrom } from "xstate"
4+
import { userMachine } from "./auth/authXService"
45
import { buildInfoMachine } from "./buildInfo/buildInfoXService"
5-
import { userMachine } from "./user/userXService"
66

77
interface XServiceContextType {
88
buildInfoXService: ActorRefFrom<typeof buildInfoMachine>
9-
userXService: ActorRefFrom<typeof userMachine>
9+
authXService: ActorRefFrom<typeof userMachine>
1010
}
1111

1212
/**
@@ -24,7 +24,7 @@ export const XServiceProvider: React.FC = ({ children }) => {
2424
<XServiceContext.Provider
2525
value={{
2626
buildInfoXService: useInterpret(buildInfoMachine),
27-
userXService: useInterpret(userMachine),
27+
authXService: useInterpret(userMachine),
2828
}}
2929
>
3030
{children}

site/src/xServices/user/userXService.ts renamed to site/src/xServices/auth/authXService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const userMachine =
1414
/** @xstate-layout N4IgpgJg5mDOIC5QFdZgE4GUAuBDbYAdLAJZQB2kA8stgMSYCSA4gHID6jrioADgPalsJfuR4gAHogDM0gJyEATAHYAbNIAscxdunKArKo0AaEAE9EG+YX0BGABz3FD6atsbbc5QF9vp1Bg4+ESkFCTkUIzkdBCiROEAbvwA1iFk5FHiAkIiYkiSiHIADITSOvbSRRqq2m7StqYWCIr2+ja2tvVV+vqaRVW+-mhYeATE6eGR0Rjo-OiEvAA2+ABmcwC24xSZ+dkkwqLiUghlyoRF+opayq4X+sqK+o2Il6qEcq5y+hrfjt+qgxAARGwUIMGwwgiAFVhjE4oREikiOCALJgLKCfa5I4yIyEZTFZQaezFK5lPTPBC2IqKUqKC4EjqqKrFOSA4FBMbgyFQGEYOgzOYLZbYNboTao9G7TEHPKgY7SewlTQ3dRyVQ6GpVSmKMqEIz2ZRKjrKIqqJzs4actIUSBRBgsDhUKEAFQxOUO+WOhvshA0ahualsqnu8kpthUhGplVUIa+rUq9ktgVGNvIkxo9FilAR5CSqS25Ez7qxnvliCMGlK1Tk6vN5p+T3ML0Ub2U7iKXmcGg8tmTILGoXTEUzAvQs3mS1WG0LxelHrlBQQIbasc7aiKtnbV3sOpaUZXBjkwd1A0B5H4EDg4g5qcL1FoJdlOIQdlpH2qhmJzJ+DWbCB7WxSmUIl2wJM0CSTPwgStO8h0mHY+BlbEvReICaSMbQflkU0fkpHtfS3MC3C+aR9ENfR+2tMEwAhSY+XQJ8UPLACziVS5TXKAxPDI8MaSjIojSqPQezNRUqLg9I7UXPZn1Q5dqn1CMNEEi4HAecNIyVGoIweVQDH0tloNvUF4JHR951LRdvQcc4PCcAx12-fDOnOeRTU7C4SXsPtjNg4ImLLJddUIdiVBpOQKJ4psmh0ASQOPRUiI8RRfF8IA */
1515
createMachine(
1616
{
17-
tsTypes: {} as import("./userXService.typegen").Typegen0,
17+
tsTypes: {} as import("./authXService.typegen").Typegen0,
1818
schema: {
1919
context: {} as UserContext,
2020
events: {} as UserEvent,

0 commit comments

Comments
 (0)