Move Group hooks to api folder

This commit is contained in:
Chewbacca
2023-05-01 14:58:40 -04:00
parent bf7d7f93a5
commit e0af6c4b2e
57 changed files with 57 additions and 61 deletions

View File

@@ -0,0 +1,17 @@
import { Entities } from 'soapbox/entity-store/entities';
import { useEntityLookup } from 'soapbox/entity-store/hooks';
import { useApi } from 'soapbox/hooks/useApi';
import { groupSchema } from 'soapbox/schemas';
function useGroupLookup(slug: string) {
const api = useApi();
return useEntityLookup(
Entities.GROUPS,
(group) => group.slug === slug,
() => api.get(`/api/v1/groups/lookup?name=${slug}`),
{ schema: groupSchema },
);
}
export { useGroupLookup };