Port b135a831eaa8b17d86345ab21f28b1bfe40dc2b2 to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
23 lines
597 B
TypeScript
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),
|
|
};
|
|
},
|
|
);
|