diff --git a/packages/web-main/src/routes/_auth/domain.select.tsx b/packages/web-main/src/routes/_auth/domain.select.tsx index f8d0ad64d9..d78e617ce4 100644 --- a/packages/web-main/src/routes/_auth/domain.select.tsx +++ b/packages/web-main/src/routes/_auth/domain.select.tsx @@ -1,5 +1,5 @@ import { Card, Chip, Company, styled } from '@takaro/lib-components'; -import { DomainOutputDTO } from '@takaro/apiclient'; +import { DomainOutputDTO, DomainOutputDTOStateEnum } from '@takaro/apiclient'; import { createFileRoute, useNavigate } from '@tanstack/react-router'; import { useUserSetSelectedDomain, userMeQueryOptions } from 'queries/user'; import { MdDomain as DomainIcon } from 'react-icons/md'; @@ -78,8 +78,12 @@ function DomainCard({ domain, isCurrentDomain }: DomainCardProps) { const navigate = useNavigate(); const { mutate, isSuccess } = useUserSetSelectedDomain(); const queryClient = useQueryClient(); + const isDisabled = domain.state === DomainOutputDTOStateEnum.Disabled; const handleDomainSelectedClick = () => { + // Logging into a disabled domain is going to error out + if (isDisabled) return; + if (isCurrentDomain === false) { mutate({ domainId: domain.id }); } @@ -97,6 +101,7 @@ function DomainCard({ domain, isCurrentDomain }: DomainCardProps) {