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/client/views/directory/hooks.js

17 lines
477 B

import { useMemo } from 'react';
export function useQuery({ text, itemsPerPage, current }, [column, direction], type, workspace = 'local') {
return useMemo(
() => ({
query: JSON.stringify({
type,
text,
workspace,
}),
sort: JSON.stringify({ [column]: direction === 'asc' ? 1 : 0 }),
...(itemsPerPage && { count: itemsPerPage }),
...(current && { offset: current }),
}),
[itemsPerPage, current, column, direction, type, workspace, text],
);
}