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/hooks/useUserInfoQuery.ts

14 lines
579 B

import type { UsersInfoParamsGet } from '@rocket.chat/rest-typings';
import { useEndpoint } from '@rocket.chat/ui-contexts';
import { useQuery } from '@tanstack/react-query';
// a hook using tanstack useQuery and useEndpoint that fetches user information from the `users.info` endpoint
export const useUserInfoQuery = (params: UsersInfoParamsGet) => {
const getUserInfo = useEndpoint('GET', '/v1/users.info');
const result = useQuery(['users.info', params], () => getUserInfo({ ...params }), {
refetchOnWindowFocus: false,
keepPreviousData: true,
});
return result;
};