This commit is contained in:
mgabdev
2020-04-28 01:33:58 -04:00
parent 763694b5ab
commit c3d0d8bde2
87 changed files with 1392 additions and 826 deletions

View File

@@ -30,6 +30,10 @@ export const UNPIN_REQUEST = 'UNPIN_REQUEST';
export const UNPIN_SUCCESS = 'UNPIN_SUCCESS';
export const UNPIN_FAIL = 'UNPIN_FAIL';
export const LIKES_FETCH_REQUEST = 'LIKES_FETCH_REQUEST';
export const LIKES_FETCH_SUCCESS = 'LIKES_FETCH_SUCCESS';
export const LIKES_FETCH_FAIL = 'LIKES_FETCH_FAIL';
export function repost(status) {
return function (dispatch, getState) {
if (!me) return;
@@ -308,3 +312,38 @@ export function unpinFail(status, error) {
skipLoading: true,
};
};
export function fetchLikes(id) {
return (dispatch, getState) => {
dispatch(fetchLikesRequest(id));
api(getState).get(`/api/v1/statuses/${id}/favourited_by`).then(response => {
dispatch(importFetchedAccounts(response.data));
dispatch(fetchLikesSuccess(id, response.data));
}).catch(error => {
dispatch(fetchLikesFail(id, error));
});
};
};
export function fetchLikesRequest(id) {
return {
type: LIKES_FETCH_REQUEST,
id,
};
};
export function fetchLikesSuccess(id, accounts) {
return {
type: LIKES_FETCH_SUCCESS,
id,
accounts,
};
};
export function fetchLikesFail(id, error) {
return {
type: LIKES_FETCH_FAIL,
error,
};
};