diff --git a/packages/frontend-2/components/auth/LoginPanel.vue b/packages/frontend-2/components/auth/LoginPanel.vue index b4529d0a17..16beb521c1 100644 --- a/packages/frontend-2/components/auth/LoginPanel.vue +++ b/packages/frontend-2/components/auth/LoginPanel.vue @@ -32,7 +32,7 @@
Don't have an account? @@ -52,7 +52,10 @@ import { useLoginOrRegisterUtils, useAuthManager } from '~~/lib/auth/composables import { LayoutDialog } from '@speckle/ui-components' import { ArrowRightIcon } from '@heroicons/vue/20/solid' import { registerRoute } from '~~/lib/common/helpers/route' -import { authLoginPanelQuery } from '~/lib/auth/graphql/queries' +import { + authLoginPanelQuery, + authLoginPanelWorkspaceInviteQuery +} from '~/lib/auth/graphql/queries' const props = withDefaults( defineProps<{ @@ -71,9 +74,19 @@ const { appId, challenge } = useLoginOrRegisterUtils() const { isLoggedIn } = useActiveUser() const { inviteToken } = useAuthManager() const router = useRouter() -const { result } = useQuery(authLoginPanelQuery, () => ({ - token: inviteToken.value -})) +const isWorkspacesEnabled = useIsWorkspacesEnabled() + +const { result } = useQuery(authLoginPanelQuery) + +const { result: workspaceInviteResult } = useQuery( + authLoginPanelWorkspaceInviteQuery, + () => ({ + token: inviteToken.value + }), + () => ({ + enabled: isWorkspacesEnabled.value + }) +) const finalRegisterRoute = computed(() => { const result = router.resolve({ @@ -87,7 +100,7 @@ const concreteComponent = computed(() => { return props.dialogMode ? LayoutDialog : 'div' }) -const workspaceInvite = computed(() => result.value?.workspaceInvite) +const workspaceInvite = computed(() => workspaceInviteResult.value?.workspaceInvite) const forcedInviteEmail = computed(() => workspaceInvite.value?.email) const serverInfo = computed(() => result.value?.serverInfo) diff --git a/packages/frontend-2/components/auth/RegisterPanel.vue b/packages/frontend-2/components/auth/RegisterPanel.vue index b13451d4b2..e4c13dea87 100644 --- a/packages/frontend-2/components/auth/RegisterPanel.vue +++ b/packages/frontend-2/components/auth/RegisterPanel.vue @@ -72,6 +72,11 @@ const registerPanelQuery = graphql(` id email } + } +`) + +const registerPanelWorkspaceInviteQuery = graphql(` + query AuthRegisterPanelWorkspaceInvite($token: String) { workspaceInvite(token: $token) { id ...AuthWorkspaceInviteHeader_PendingWorkspaceCollaborator @@ -79,10 +84,20 @@ const registerPanelQuery = graphql(` } `) +const isWorkspacesEnabled = useIsWorkspacesEnabled() const { appId, challenge, inviteToken } = useLoginOrRegisterUtils() const { result } = useQuery(registerPanelQuery, () => ({ token: inviteToken.value })) +const { result: workspaceInviteResult } = useQuery( + registerPanelWorkspaceInviteQuery, + () => ({ + token: inviteToken.value + }), + () => ({ + enabled: isWorkspacesEnabled.value + }) +) const newsletterConsent = ref(false) @@ -97,5 +112,5 @@ const hasThirdPartyStrategies = computed(() => ) const isInviteOnly = computed(() => !!serverInfo.value?.inviteOnly) -const workspaceInvite = computed(() => result.value?.workspaceInvite) +const workspaceInvite = computed(() => workspaceInviteResult.value?.workspaceInvite) diff --git a/packages/frontend-2/components/auth/WorkspaceInviteHeader.vue b/packages/frontend-2/components/auth/WorkspaceInviteHeader.vue index 423a3a9a67..442a9ac1d0 100644 --- a/packages/frontend-2/components/auth/WorkspaceInviteHeader.vue +++ b/packages/frontend-2/components/auth/WorkspaceInviteHeader.vue @@ -4,13 +4,13 @@
You're accepting an invitation to join {{ invite.workspaceName }} + + + diff --git a/packages/frontend-2/components/workspace/invite/Block.vue b/packages/frontend-2/components/workspace/invite/Block.vue index ecca0ab8f6..5fb55fb8fb 100644 --- a/packages/frontend-2/components/workspace/invite/Block.vue +++ b/packages/frontend-2/components/workspace/invite/Block.vue @@ -7,12 +7,15 @@