You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
956 B

  1. import api from '../api';
  2. export const ACCOUNT_NOTE_SUBMIT_REQUEST = 'ACCOUNT_NOTE_SUBMIT_REQUEST';
  3. export const ACCOUNT_NOTE_SUBMIT_SUCCESS = 'ACCOUNT_NOTE_SUBMIT_SUCCESS';
  4. export const ACCOUNT_NOTE_SUBMIT_FAIL = 'ACCOUNT_NOTE_SUBMIT_FAIL';
  5. export function submitAccountNote(id, value) {
  6. return (dispatch, getState) => {
  7. dispatch(submitAccountNoteRequest());
  8. api(getState).post(`/api/v1/accounts/${id}/note`, {
  9. comment: value,
  10. }).then(response => {
  11. dispatch(submitAccountNoteSuccess(response.data));
  12. }).catch(error => dispatch(submitAccountNoteFail(error)));
  13. };
  14. };
  15. export function submitAccountNoteRequest() {
  16. return {
  17. type: ACCOUNT_NOTE_SUBMIT_REQUEST,
  18. };
  19. };
  20. export function submitAccountNoteSuccess(relationship) {
  21. return {
  22. type: ACCOUNT_NOTE_SUBMIT_SUCCESS,
  23. relationship,
  24. };
  25. };
  26. export function submitAccountNoteFail(error) {
  27. return {
  28. type: ACCOUNT_NOTE_SUBMIT_FAIL,
  29. error,
  30. };
  31. };