diff --git a/src/shell/components/GlobalAccountMenu/index.tsx b/src/shell/components/GlobalAccountMenu/index.tsx index 33dc8988ae..90595001e9 100644 --- a/src/shell/components/GlobalAccountMenu/index.tsx +++ b/src/shell/components/GlobalAccountMenu/index.tsx @@ -1,4 +1,4 @@ -import { FC, useMemo } from "react"; +import { FC, useEffect, useMemo } from "react"; import { useDispatch, useSelector } from "react-redux"; import { @@ -36,6 +36,7 @@ export const GlobalAccountMenu: FC = ({ onShowDocsMenu, }) => { const user: User = useSelector((state: AppState) => state.user); + const auth = useSelector((state: AppState) => state.auth); const { data: roles, isLoading: isLoadingRoles } = useGetUsersRolesQuery(); const userRole = useMemo(() => { @@ -44,6 +45,12 @@ export const GlobalAccountMenu: FC = ({ const dispatch = useDispatch(); + useEffect(() => { + if (!auth.valid) { + onClose(); + } + }, [auth.valid]); + const handleClickAction = ([action, location]: ClickAction) => { switch (action) { case "openUrl": diff --git a/src/shell/store/types.ts b/src/shell/store/types.ts index 6ddb5d447d..b3c678b2e7 100644 --- a/src/shell/store/types.ts +++ b/src/shell/store/types.ts @@ -16,7 +16,11 @@ export type AppState = { frames: any; installed: InstalledApp[]; }; - auth: any; + auth: { + checking: boolean; + valid: boolean; + sessionEnding: boolean; + }; user: any; users: any; releases: any;