Progress
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
import api from '../api';
|
||||
|
||||
export const STATUS_REVISION_LIST_LOAD = 'STATUS_REVISION_LIST';
|
||||
export const STATUS_REVISION_LIST_LOAD_SUCCESS = 'STATUS_REVISION_LIST_SUCCESS';
|
||||
export const STATUS_REVISION_LIST_LOAD_FAIL = 'STATUS_REVISION_LIST_FAIL';
|
||||
|
||||
const loadSuccess = data => ({ type: STATUS_REVISION_LIST_LOAD_SUCCESS, payload: data });
|
||||
const loadFail = e => ({ type: STATUS_REVISION_LIST_LOAD_FAIL, payload: e });
|
||||
|
||||
export function load(statusId) {
|
||||
return (dispatch, getState) => {
|
||||
api(getState).get(`/api/v1/statuses/${statusId}/revisions`)
|
||||
.then(res => dispatch(loadSuccess(res.data)))
|
||||
.catch(e => dispatch(loadFail(e)));
|
||||
};
|
||||
}
|
||||
23
app/javascript/gabsocial/actions/status_revisions.js
Normal file
23
app/javascript/gabsocial/actions/status_revisions.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import api from '../api'
|
||||
|
||||
export const STATUS_REVISIONS_LOAD = 'STATUS_REVISIONS_LOAD'
|
||||
export const STATUS_REVISIONS_LOAD_SUCCESS = 'STATUS_REVISIONS_SUCCESS'
|
||||
export const STATUS_REVISIONS_LOAD_FAIL = 'STATUS_REVISIONS_FAIL'
|
||||
|
||||
const loadStatusRevisionsSuccess = (data) => ({
|
||||
type: STATUS_REVISIONS_LOAD_SUCCESS,
|
||||
revisions: data,
|
||||
})
|
||||
|
||||
const loadStatusRevisionsFail = () => ({
|
||||
type: STATUS_REVISIONS_LOAD_FAIL,
|
||||
error: true,
|
||||
})
|
||||
|
||||
export function loadStatusRevisions(statusId) {
|
||||
return (dispatch, getState) => {
|
||||
api(getState).get(`/api/v1/statuses/${statusId}/revisions`)
|
||||
.then(res => dispatch(loadStatusRevisionsSuccess(res.data)))
|
||||
.catch(() => dispatch(loadStatusRevisionsFail()))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user