Support Mastodon trending links
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
@ -44,3 +44,6 @@ export { useHashtagStream } from './streaming/useHashtagStream';
|
||||
export { useListStream } from './streaming/useListStream';
|
||||
export { useGroupStream } from './streaming/useGroupStream';
|
||||
export { useRemoteStream } from './streaming/useRemoteStream';
|
||||
|
||||
// Trends
|
||||
export { useTrendingLinks } from './trends/useTrendingLinks';
|
||||
|
||||
20
src/api/hooks/trends/useTrendingLinks.ts
Normal file
20
src/api/hooks/trends/useTrendingLinks.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { trendsLinkSchema } from 'pl-api';
|
||||
|
||||
import { Entities } from 'soapbox/entity-store/entities';
|
||||
import { useEntities } from 'soapbox/entity-store/hooks';
|
||||
import { useClient, useFeatures } from 'soapbox/hooks';
|
||||
|
||||
const useTrendingLinks = () => {
|
||||
const client = useClient();
|
||||
const features = useFeatures();
|
||||
|
||||
const { entities, ...rest } = useEntities(
|
||||
[Entities.TRENDS_LINKS],
|
||||
() => client.trends.getTrendingLinks(),
|
||||
{ schema: trendsLinkSchema, enabled: features.trendingLinks },
|
||||
);
|
||||
|
||||
return { trendingLinks: entities, ...rest };
|
||||
};
|
||||
|
||||
export { useTrendingLinks };
|
||||
Reference in New Issue
Block a user