The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/views/admin/users/hooks/usePendingUsersCount.ts

28 lines
786 B

import type { Serialized } from '@rocket.chat/core-typings';
import type { DefaultUserInfo, UsersListStatusParamsGET } from '@rocket.chat/rest-typings';
import { useEndpoint } from '@rocket.chat/ui-contexts';
import { useQuery } from '@tanstack/react-query';
const usePendingUsersCount = (users: Serialized<DefaultUserInfo[]> | undefined) => {
const getUsers = useEndpoint('GET', '/v1/users.listByStatus');
return useQuery({
queryKey: ['pendingUsersCount', users],
queryFn: async () => {
const payload: UsersListStatusParamsGET = {
status: 'deactivated',
inactiveReason: ['pending_approval'],
type: 'user',
count: 1,
};
return getUsers(payload);
},
enabled: !!users,
select: (data) => data?.total,
});
};
export default usePendingUsersCount;