mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-02-03 13:33:32 -05:00
f441e3db4e
Port 7a3dea385e48c72ff4d1553709f618bc5070b255 to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
25 lines
734 B
TypeScript
25 lines
734 B
TypeScript
import {
|
|
apiGetSuggestions,
|
|
apiDeleteSuggestion,
|
|
} from 'flavours/glitch/api/suggestions';
|
|
import { createDataLoadingThunk } from 'flavours/glitch/store/typed_functions';
|
|
|
|
import { fetchRelationships } from './accounts';
|
|
import { importFetchedAccounts } from './importer';
|
|
|
|
export const fetchSuggestions = createDataLoadingThunk(
|
|
'suggestions/fetch',
|
|
() => apiGetSuggestions(20),
|
|
(data, { dispatch }) => {
|
|
dispatch(importFetchedAccounts(data.map((x) => x.account)));
|
|
dispatch(fetchRelationships(data.map((x) => x.account.id)));
|
|
|
|
return data;
|
|
},
|
|
);
|
|
|
|
export const dismissSuggestion = createDataLoadingThunk(
|
|
'suggestions/dismiss',
|
|
({ accountId }: { accountId: string }) => apiDeleteSuggestion(accountId),
|
|
);
|