fix(login): identities should be null after a user disconnection
Related to #1806
This commit is contained in:
@@ -37,16 +37,23 @@ export function useLazyCurrentUserIdentities() {
|
|||||||
export function useCurrentUserIdentities() {
|
export function useCurrentUserIdentities() {
|
||||||
const { currentUser } = useCurrentUserClient();
|
const { currentUser } = useCurrentUserClient();
|
||||||
|
|
||||||
|
const enabled = computed(
|
||||||
|
() =>
|
||||||
|
currentUser.value?.id !== undefined &&
|
||||||
|
currentUser.value?.id !== null &&
|
||||||
|
currentUser.value?.isLoggedIn === true
|
||||||
|
);
|
||||||
|
|
||||||
const { result, error, loading } = useQuery<{
|
const { result, error, loading } = useQuery<{
|
||||||
loggedUser: Pick<ICurrentUser, "actors">;
|
loggedUser: Pick<ICurrentUser, "actors">;
|
||||||
}>(IDENTITIES, {}, () => ({
|
}>(IDENTITIES, {}, () => ({
|
||||||
enabled:
|
enabled: enabled,
|
||||||
currentUser.value?.id !== undefined &&
|
|
||||||
currentUser.value?.id !== null &&
|
|
||||||
currentUser.value?.isLoggedIn === true,
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const identities = computed(() => result.value?.loggedUser?.actors);
|
const identities = computed(() =>
|
||||||
|
enabled.value ? result.value?.loggedUser?.actors : null
|
||||||
|
);
|
||||||
|
|
||||||
return { identities, error, loading };
|
return { identities, error, loading };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user