You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
590 B
22 lines
590 B
import { createDataLoadingThunk } from 'mastodon/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), |
|
}; |
|
}, |
|
);
|
|
|