Mastodon/app/javascript/flavours/glitch/actions/accounts_familiar_followers.ts
diondiondion 59f986784f [Glitch] feat: Add "Followers you know" widget to user profiles
Port b135a831eaa8b17d86345ab21f28b1bfe40dc2b2 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2025-05-14 13:59:41 +02:00

23 lines
597 B
TypeScript

import { createDataLoadingThunk } from 'flavours/glitch/store/typed_functions';
import { apiGetFamiliarFollowers } from '../api/accounts';
import { importFetchedAccounts } from './importer';
export const fetchAccountsFamiliarFollowers = createDataLoadingThunk(
'accounts_familiar_followers/fetch',
({ id }: { id: string }) => apiGetFamiliarFollowers(id),
([data], { dispatch }) => {
if (!data) {
return null;
}
dispatch(importFetchedAccounts(data.accounts));
return {
id: data.id,
accountIds: data.accounts.map((account) => account.id),
};
},
);