Fix createDataLoadingThunk
and related actions (#30408)
This commit is contained in:
parent
133d98fb25
commit
b6fd14f0e2
12 changed files with 41 additions and 35 deletions
|
@ -3,7 +3,8 @@ import { createDataLoadingThunk } from 'mastodon/store/typed_functions';
|
|||
|
||||
export const submitAccountNote = createDataLoadingThunk(
|
||||
'account_note/submit',
|
||||
(accountId: string, note: string) => apiSubmitAccountNote(accountId, note),
|
||||
({ accountId, note }: { accountId: string; note: string }) =>
|
||||
apiSubmitAccountNote(accountId, note),
|
||||
(relationship) => ({ relationship }),
|
||||
{ skipLoading: true },
|
||||
);
|
||||
|
|
|
@ -6,8 +6,13 @@ import { importFetchedStatus } from './importer';
|
|||
|
||||
export const reblog = createDataLoadingThunk(
|
||||
'status/reblog',
|
||||
(statusId: string, visibility: StatusVisibility) =>
|
||||
apiReblog(statusId, visibility),
|
||||
({
|
||||
statusId,
|
||||
visibility,
|
||||
}: {
|
||||
statusId: string;
|
||||
visibility: StatusVisibility;
|
||||
}) => apiReblog(statusId, visibility),
|
||||
(data, { dispatch, discardLoadData }) => {
|
||||
// The reblog API method returns a new status wrapped around the original. In this case we are only
|
||||
// interested in how the original is modified, hence passing it skipping the wrapper
|
||||
|
@ -20,7 +25,7 @@ export const reblog = createDataLoadingThunk(
|
|||
|
||||
export const unreblog = createDataLoadingThunk(
|
||||
'status/unreblog',
|
||||
(statusId: string) => apiUnreblog(statusId),
|
||||
({ statusId }: { statusId: string }) => apiUnreblog(statusId),
|
||||
(data, { dispatch, discardLoadData }) => {
|
||||
dispatch(importFetchedStatus(data));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue