mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
fix: Display service banner after login (#5594)
This commit is contained in:
@ -1,15 +1,23 @@
|
||||
import { useActor } from "@xstate/react"
|
||||
import { useContext } from "react"
|
||||
import { useContext, useEffect } from "react"
|
||||
import { XServiceContext } from "xServices/StateContext"
|
||||
import { ServiceBannerView } from "./ServiceBannerView"
|
||||
|
||||
export const ServiceBanner: React.FC = () => {
|
||||
const xServices = useContext(XServiceContext)
|
||||
const [appearanceState] = useActor(xServices.appearanceXService)
|
||||
|
||||
const [appearanceState, appearanceSend] = useActor(
|
||||
xServices.appearanceXService,
|
||||
)
|
||||
const [authState] = useActor(xServices.authXService)
|
||||
const { message, background_color, enabled } =
|
||||
appearanceState.context.appearance.service_banner
|
||||
|
||||
useEffect(() => {
|
||||
if (authState.matches("signedIn")) {
|
||||
appearanceSend("GET_APPEARANCE")
|
||||
}
|
||||
}, [appearanceSend, authState])
|
||||
|
||||
if (!enabled) {
|
||||
return null
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ export const appearanceMachine = createMachine(
|
||||
appearance: emptyAppearance,
|
||||
preview: false,
|
||||
},
|
||||
initial: "gettingAppearance",
|
||||
initial: "idle",
|
||||
states: {
|
||||
idle: {
|
||||
on: {
|
||||
|
Reference in New Issue
Block a user