diff --git a/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.tsx b/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.tsx index 36919e970c2..2045a71820a 100644 --- a/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.tsx +++ b/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.tsx @@ -25,8 +25,9 @@ export const OrganizationInvite = () => { ) const hasError = isError || (isSuccess && (data.token_does_not_exist || data.expired_token || !data.email_match)) + const isNotSignedInError = error?.message.includes('No authorization token was found') - const organizationName = data?.organization_name ?? name ?? 'an organization' + const organizationName = isSuccess ? data?.organization_name : 'an organization' const loginRedirectLink = `/sign-in?returnTo=${encodeURIComponent(`/join?token=${token}&slug=${slug}`)}` const { mutate: joinOrganization, isLoading: isJoining } = @@ -50,27 +51,29 @@ export const OrganizationInvite = () => {

You have been invited to join

{organizationName}

- {slug &&

{`organization slug: ${slug}`}

} + {isSuccess && slug && ( +

{`organization slug: ${slug}`}

+ )}
-
- {profile === undefined && ( -
-

- You will need to sign in to accept this invitation -

-
- - -
+ {profile === undefined && ( +
+

+ You will need to sign in to accept this invitation +

+
+ +
- )} - {hasError && ( +
+ )} +
+ {hasError && !isNotSignedInError && (