2020-07-01 03:19:50 +10:00
|
|
|
import api from '../api';
|
|
|
|
|
|
|
|
export const ACCOUNT_NOTE_SUBMIT_REQUEST = 'ACCOUNT_NOTE_SUBMIT_REQUEST';
|
|
|
|
export const ACCOUNT_NOTE_SUBMIT_SUCCESS = 'ACCOUNT_NOTE_SUBMIT_SUCCESS';
|
|
|
|
export const ACCOUNT_NOTE_SUBMIT_FAIL = 'ACCOUNT_NOTE_SUBMIT_FAIL';
|
|
|
|
|
2020-07-07 09:24:03 +10:00
|
|
|
export function submitAccountNote(id, value) {
|
2020-07-01 03:19:50 +10:00
|
|
|
return (dispatch, getState) => {
|
|
|
|
dispatch(submitAccountNoteRequest());
|
|
|
|
|
|
|
|
api(getState).post(`/api/v1/accounts/${id}/note`, {
|
2020-07-07 09:24:03 +10:00
|
|
|
comment: value,
|
2020-07-01 03:19:50 +10:00
|
|
|
}).then(response => {
|
|
|
|
dispatch(submitAccountNoteSuccess(response.data));
|
|
|
|
}).catch(error => dispatch(submitAccountNoteFail(error)));
|
|
|
|
};
|
2022-12-19 02:51:37 +11:00
|
|
|
}
|
2020-07-01 03:19:50 +10:00
|
|
|
|
|
|
|
export function submitAccountNoteRequest() {
|
|
|
|
return {
|
|
|
|
type: ACCOUNT_NOTE_SUBMIT_REQUEST,
|
|
|
|
};
|
2022-12-19 02:51:37 +11:00
|
|
|
}
|
2020-07-01 03:19:50 +10:00
|
|
|
|
|
|
|
export function submitAccountNoteSuccess(relationship) {
|
|
|
|
return {
|
|
|
|
type: ACCOUNT_NOTE_SUBMIT_SUCCESS,
|
|
|
|
relationship,
|
|
|
|
};
|
2022-12-19 02:51:37 +11:00
|
|
|
}
|
2020-07-01 03:19:50 +10:00
|
|
|
|
|
|
|
export function submitAccountNoteFail(error) {
|
|
|
|
return {
|
|
|
|
type: ACCOUNT_NOTE_SUBMIT_FAIL,
|
|
|
|
error,
|
|
|
|
};
|
2022-12-19 02:51:37 +11:00
|
|
|
}
|