2023-11-04 00:00:03 +09:00
|
|
|
import type { ApiRelationshipJSON } from 'mastodon/api_types/relationships';
|
2023-09-11 23:09:22 +09: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-04 00:00:03 +09:00
|
|
|
const response = await api(getState).post<ApiRelationshipJSON>(
|
2023-09-11 23:09:22 +09:00
|
|
|
`/api/v1/accounts/${args.id}/note`,
|
|
|
|
{
|
|
|
|
comment: args.value,
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
return { relationship: response.data };
|
|
|
|
},
|
|
|
|
);
|