Remove unused query
This commit is contained in:
parent
ca0987dec2
commit
9fe2d4f92c
1 changed files with 0 additions and 40 deletions
|
@ -1,40 +0,0 @@
|
|||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { useApi } from 'soapbox/hooks';
|
||||
import { normalizeAccount } from 'soapbox/normalizers';
|
||||
import { GroupRoles } from 'soapbox/schemas/group-member';
|
||||
|
||||
const GroupMemberKeys = {
|
||||
members: (id: string, role: string) => ['group', id, role] as const,
|
||||
};
|
||||
|
||||
const useGroupMembers = (groupId: string, role: GroupRoles) => {
|
||||
const api = useApi();
|
||||
|
||||
const getQuery = async () => {
|
||||
const { data } = await api.get(`/api/v1/groups/${groupId}/memberships`, {
|
||||
params: {
|
||||
role,
|
||||
},
|
||||
});
|
||||
|
||||
const result = data.map((member: any) => {
|
||||
return {
|
||||
...member,
|
||||
account: normalizeAccount(member.account),
|
||||
};
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
return useQuery(
|
||||
GroupMemberKeys.members(groupId, role),
|
||||
getQuery,
|
||||
{
|
||||
placeholderData: [],
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export { useGroupMembers };
|
Loading…
Reference in a new issue