]> Untitled Git - lemmy-ui.git/blob - src/shared/utils/app/community-search.ts
fix: Fix badge alignment and break out into component
[lemmy-ui.git] / src / shared / utils / app / community-search.ts
1 import { fetchCommunities } from "@utils/app";
2 import { hostname } from "@utils/helpers";
3 import { CommunityTribute } from "@utils/types";
4
5 export default async function communitySearch(
6   text: string
7 ): Promise<CommunityTribute[]> {
8   const communitiesResponse = await fetchCommunities(text);
9
10   return communitiesResponse.map(cv => ({
11     key: `!${cv.community.name}@${hostname(cv.community.actor_id)}`,
12     view: cv,
13   }));
14 }