diff --git a/src/composition/apollo/actor.ts b/src/composition/apollo/actor.ts index 0d480513d..c2c401a73 100644 --- a/src/composition/apollo/actor.ts +++ b/src/composition/apollo/actor.ts @@ -37,16 +37,23 @@ export function useLazyCurrentUserIdentities() { export function useCurrentUserIdentities() { const { currentUser } = useCurrentUserClient(); + const enabled = computed( + () => + currentUser.value?.id !== undefined && + currentUser.value?.id !== null && + currentUser.value?.isLoggedIn === true + ); + const { result, error, loading } = useQuery<{ loggedUser: Pick; }>(IDENTITIES, {}, () => ({ - enabled: - currentUser.value?.id !== undefined && - currentUser.value?.id !== null && - currentUser.value?.isLoggedIn === true, + enabled: enabled, })); - const identities = computed(() => result.value?.loggedUser?.actors); + const identities = computed(() => + enabled.value ? result.value?.loggedUser?.actors : null + ); + return { identities, error, loading }; }