packages/frontend/core/src hooks -> components/hooks atoms -> components/atoms layouts -> components/layouts providers -> components/providers mixpanel -> @affine/track ~~shared~~ ~~unexpected-application-state~~
28 lines
569 B
TypeScript
28 lines
569 B
TypeScript
import { useQuery } from '@affine/core/components/hooks/use-query';
|
|
import { listUsersQuery } from '@affine/graphql';
|
|
import { useState } from 'react';
|
|
|
|
export const useUserList = () => {
|
|
const [pagination, setPagination] = useState({
|
|
pageIndex: 0,
|
|
pageSize: 10,
|
|
});
|
|
const {
|
|
data: { users },
|
|
} = useQuery({
|
|
query: listUsersQuery,
|
|
variables: {
|
|
filter: {
|
|
first: pagination.pageSize,
|
|
skip: pagination.pageIndex * pagination.pageSize,
|
|
},
|
|
},
|
|
});
|
|
|
|
return {
|
|
users,
|
|
pagination,
|
|
setPagination,
|
|
};
|
|
};
|