account_notes.ts 535 B

123456789101112131415161718
  1. import type { ApiRelationshipJSON } from 'mastodon/api_types/relationships';
  2. import { createAppAsyncThunk } from 'mastodon/store/typed_functions';
  3. import api from '../api';
  4. export const submitAccountNote = createAppAsyncThunk(
  5. 'account_note/submit',
  6. async (args: { id: string; value: string }, { getState }) => {
  7. const response = await api(getState).post<ApiRelationshipJSON>(
  8. `/api/v1/accounts/${args.id}/note`,
  9. {
  10. comment: args.value,
  11. },
  12. );
  13. return { relationship: response.data };
  14. },
  15. );