fix(admin): frequent query requests in the search (#7854)

This commit is contained in:
JimmFly
2024-08-14 03:49:45 +00:00
parent f69f026ac3
commit 05247bb24e
7 changed files with 141 additions and 81 deletions
@@ -3,10 +3,12 @@ import {
useMutateQueryResource,
useMutation,
} from '@affine/core/hooks/use-mutation';
import { useQuery } from '@affine/core/hooks/use-query';
import {
createChangePasswordUrlMutation,
createUserMutation,
deleteUserMutation,
getUsersCountQuery,
listUsersQuery,
updateAccountFeaturesMutation,
updateAccountMutation,
@@ -159,3 +161,12 @@ export const useDeleteUser = () => {
return deleteById;
};
export const useUserCount = () => {
const {
data: { usersCount },
} = useQuery({
query: getUsersCountQuery,
});
return usersCount;
};