mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2025-01-26 11:55:52 +00:00
14 lines
431 B
TypeScript
14 lines
431 B
TypeScript
import { fetchCommunities } from "@utils/app";
|
|
import { hostname } from "@utils/helpers";
|
|
import { CommunityTribute } from "@utils/types";
|
|
|
|
export default async function communitySearch(
|
|
text: string,
|
|
): Promise<CommunityTribute[]> {
|
|
const communitiesResponse = await fetchCommunities(text);
|
|
|
|
return communitiesResponse.map(cv => ({
|
|
key: `!${cv.community.name}@${hostname(cv.community.actor_id)}`,
|
|
view: cv,
|
|
}));
|
|
}
|