2023-11-03 17:00:03 +02:00
|
|
|
import type { ApiRelationshipJSON } from 'mastodon/api_types/relationships';
|
2023-09-11 17:09:22 +03:00
|
|
|
import { createAppAsyncThunk } from 'mastodon/store/typed_functions';
|
|
|
|
|
|
|
|
import api from '../api';
|
|
|
|
|
|
|
|
export const submitAccountNote = createAppAsyncThunk(
|
|
|
|
'account_note/submit',
|
|
|
|
async (args: { id: string; value: string }, { getState }) => {
|
2023-11-03 17:00:03 +02:00
|
|
|
const response = await api(getState).post<ApiRelationshipJSON>(
|
2023-09-11 17:09:22 +03:00
|
|
|
`/api/v1/accounts/${args.id}/note`,
|
|
|
|
{
|
|
|
|
comment: args.value,
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
return { relationship: response.data };
|
|
|
|
},
|
|
|
|
);
|