2020-03-27 22:57:03 +00:00
|
|
|
import api from '../api'
|
|
|
|
|
2020-11-25 21:22:37 +00:00
|
|
|
export const STATUS_REVISIONS_LOAD_REQUEST = 'STATUS_REVISIONS_LOAD_REQUEST'
|
2020-03-27 22:57:03 +00:00
|
|
|
export const STATUS_REVISIONS_LOAD_SUCCESS = 'STATUS_REVISIONS_SUCCESS'
|
|
|
|
export const STATUS_REVISIONS_LOAD_FAIL = 'STATUS_REVISIONS_FAIL'
|
|
|
|
|
2020-11-25 21:22:37 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2020-11-15 18:48:32 +00:00
|
|
|
export const loadStatusRevisions = (statusId) => (dispatch, getState) => {
|
2020-11-25 21:22:37 +00:00
|
|
|
dispatch(loadStatusRevisionsRequest())
|
2020-11-15 18:48:32 +00:00
|
|
|
api(getState).get(`/api/v1/statuses/${statusId}/revisions`)
|
|
|
|
.then(res => dispatch(loadStatusRevisionsSuccess(res.data)))
|
2020-12-08 04:39:13 +00:00
|
|
|
.catch((error) => dispatch(loadStatusRevisionsFail(error)))
|
2020-11-15 18:48:32 +00:00
|
|
|
}
|
|
|
|
|
2020-11-25 21:22:37 +00:00
|
|
|
const loadStatusRevisionsRequest = () => ({
|
|
|
|
type: STATUS_REVISIONS_LOAD_REQUEST,
|
|
|
|
})
|
|
|
|
|
2020-03-27 22:57:03 +00:00
|
|
|
const loadStatusRevisionsSuccess = (data) => ({
|
|
|
|
type: STATUS_REVISIONS_LOAD_SUCCESS,
|
|
|
|
revisions: data,
|
|
|
|
})
|
|
|
|
|
2020-12-08 04:39:13 +00:00
|
|
|
const loadStatusRevisionsFail = (error) => ({
|
2020-03-27 22:57:03 +00:00
|
|
|
type: STATUS_REVISIONS_LOAD_FAIL,
|
2020-12-08 04:39:13 +00:00
|
|
|
showToast: true,
|
|
|
|
error,
|
|
|
|
})
|