1 import api
, { getLinks
} from '../api';
2 import Immutable
from 'immutable';
4 export const ACCOUNT_FETCH_REQUEST
= 'ACCOUNT_FETCH_REQUEST';
5 export const ACCOUNT_FETCH_SUCCESS
= 'ACCOUNT_FETCH_SUCCESS';
6 export const ACCOUNT_FETCH_FAIL
= 'ACCOUNT_FETCH_FAIL';
8 export const ACCOUNT_FOLLOW_REQUEST
= 'ACCOUNT_FOLLOW_REQUEST';
9 export const ACCOUNT_FOLLOW_SUCCESS
= 'ACCOUNT_FOLLOW_SUCCESS';
10 export const ACCOUNT_FOLLOW_FAIL
= 'ACCOUNT_FOLLOW_FAIL';
12 export const ACCOUNT_UNFOLLOW_REQUEST
= 'ACCOUNT_UNFOLLOW_REQUEST';
13 export const ACCOUNT_UNFOLLOW_SUCCESS
= 'ACCOUNT_UNFOLLOW_SUCCESS';
14 export const ACCOUNT_UNFOLLOW_FAIL
= 'ACCOUNT_UNFOLLOW_FAIL';
16 export const ACCOUNT_BLOCK_REQUEST
= 'ACCOUNT_BLOCK_REQUEST';
17 export const ACCOUNT_BLOCK_SUCCESS
= 'ACCOUNT_BLOCK_SUCCESS';
18 export const ACCOUNT_BLOCK_FAIL
= 'ACCOUNT_BLOCK_FAIL';
20 export const ACCOUNT_UNBLOCK_REQUEST
= 'ACCOUNT_UNBLOCK_REQUEST';
21 export const ACCOUNT_UNBLOCK_SUCCESS
= 'ACCOUNT_UNBLOCK_SUCCESS';
22 export const ACCOUNT_UNBLOCK_FAIL
= 'ACCOUNT_UNBLOCK_FAIL';
24 export const ACCOUNT_MUTE_REQUEST
= 'ACCOUNT_MUTE_REQUEST';
25 export const ACCOUNT_MUTE_SUCCESS
= 'ACCOUNT_MUTE_SUCCESS';
26 export const ACCOUNT_MUTE_FAIL
= 'ACCOUNT_MUTE_FAIL';
28 export const ACCOUNT_UNMUTE_REQUEST
= 'ACCOUNT_UNMUTE_REQUEST';
29 export const ACCOUNT_UNMUTE_SUCCESS
= 'ACCOUNT_UNMUTE_SUCCESS';
30 export const ACCOUNT_UNMUTE_FAIL
= 'ACCOUNT_UNMUTE_FAIL';
32 export const ACCOUNT_TIMELINE_FETCH_REQUEST
= 'ACCOUNT_TIMELINE_FETCH_REQUEST';
33 export const ACCOUNT_TIMELINE_FETCH_SUCCESS
= 'ACCOUNT_TIMELINE_FETCH_SUCCESS';
34 export const ACCOUNT_TIMELINE_FETCH_FAIL
= 'ACCOUNT_TIMELINE_FETCH_FAIL';
36 export const ACCOUNT_TIMELINE_EXPAND_REQUEST
= 'ACCOUNT_TIMELINE_EXPAND_REQUEST';
37 export const ACCOUNT_TIMELINE_EXPAND_SUCCESS
= 'ACCOUNT_TIMELINE_EXPAND_SUCCESS';
38 export const ACCOUNT_TIMELINE_EXPAND_FAIL
= 'ACCOUNT_TIMELINE_EXPAND_FAIL';
40 export const ACCOUNT_MEDIA_TIMELINE_FETCH_REQUEST
= 'ACCOUNT_MEDIA_TIMELINE_FETCH_REQUEST';
41 export const ACCOUNT_MEDIA_TIMELINE_FETCH_SUCCESS
= 'ACCOUNT_MEDIA_TIMELINE_FETCH_SUCCESS';
42 export const ACCOUNT_MEDIA_TIMELINE_FETCH_FAIL
= 'ACCOUNT_MEDIA_TIMELINE_FETCH_FAIL';
44 export const ACCOUNT_MEDIA_TIMELINE_EXPAND_REQUEST
= 'ACCOUNT_MEDIA_TIMELINE_EXPAND_REQUEST';
45 export const ACCOUNT_MEDIA_TIMELINE_EXPAND_SUCCESS
= 'ACCOUNT_MEDIA_TIMELINE_EXPAND_SUCCESS';
46 export const ACCOUNT_MEDIA_TIMELINE_EXPAND_FAIL
= 'ACCOUNT_MEDIA_TIMELINE_EXPAND_FAIL';
48 export const FOLLOWERS_FETCH_REQUEST
= 'FOLLOWERS_FETCH_REQUEST';
49 export const FOLLOWERS_FETCH_SUCCESS
= 'FOLLOWERS_FETCH_SUCCESS';
50 export const FOLLOWERS_FETCH_FAIL
= 'FOLLOWERS_FETCH_FAIL';
52 export const FOLLOWERS_EXPAND_REQUEST
= 'FOLLOWERS_EXPAND_REQUEST';
53 export const FOLLOWERS_EXPAND_SUCCESS
= 'FOLLOWERS_EXPAND_SUCCESS';
54 export const FOLLOWERS_EXPAND_FAIL
= 'FOLLOWERS_EXPAND_FAIL';
56 export const FOLLOWING_FETCH_REQUEST
= 'FOLLOWING_FETCH_REQUEST';
57 export const FOLLOWING_FETCH_SUCCESS
= 'FOLLOWING_FETCH_SUCCESS';
58 export const FOLLOWING_FETCH_FAIL
= 'FOLLOWING_FETCH_FAIL';
60 export const FOLLOWING_EXPAND_REQUEST
= 'FOLLOWING_EXPAND_REQUEST';
61 export const FOLLOWING_EXPAND_SUCCESS
= 'FOLLOWING_EXPAND_SUCCESS';
62 export const FOLLOWING_EXPAND_FAIL
= 'FOLLOWING_EXPAND_FAIL';
64 export const RELATIONSHIPS_FETCH_REQUEST
= 'RELATIONSHIPS_FETCH_REQUEST';
65 export const RELATIONSHIPS_FETCH_SUCCESS
= 'RELATIONSHIPS_FETCH_SUCCESS';
66 export const RELATIONSHIPS_FETCH_FAIL
= 'RELATIONSHIPS_FETCH_FAIL';
68 export const FOLLOW_REQUESTS_FETCH_REQUEST
= 'FOLLOW_REQUESTS_FETCH_REQUEST';
69 export const FOLLOW_REQUESTS_FETCH_SUCCESS
= 'FOLLOW_REQUESTS_FETCH_SUCCESS';
70 export const FOLLOW_REQUESTS_FETCH_FAIL
= 'FOLLOW_REQUESTS_FETCH_FAIL';
72 export const FOLLOW_REQUESTS_EXPAND_REQUEST
= 'FOLLOW_REQUESTS_EXPAND_REQUEST';
73 export const FOLLOW_REQUESTS_EXPAND_SUCCESS
= 'FOLLOW_REQUESTS_EXPAND_SUCCESS';
74 export const FOLLOW_REQUESTS_EXPAND_FAIL
= 'FOLLOW_REQUESTS_EXPAND_FAIL';
76 export const FOLLOW_REQUEST_AUTHORIZE_REQUEST
= 'FOLLOW_REQUEST_AUTHORIZE_REQUEST';
77 export const FOLLOW_REQUEST_AUTHORIZE_SUCCESS
= 'FOLLOW_REQUEST_AUTHORIZE_SUCCESS';
78 export const FOLLOW_REQUEST_AUTHORIZE_FAIL
= 'FOLLOW_REQUEST_AUTHORIZE_FAIL';
80 export const FOLLOW_REQUEST_REJECT_REQUEST
= 'FOLLOW_REQUEST_REJECT_REQUEST';
81 export const FOLLOW_REQUEST_REJECT_SUCCESS
= 'FOLLOW_REQUEST_REJECT_SUCCESS';
82 export const FOLLOW_REQUEST_REJECT_FAIL
= 'FOLLOW_REQUEST_REJECT_FAIL';
84 export function fetchAccount(id
) {
85 return (dispatch
, getState
) => {
86 dispatch(fetchRelationships([id
]));
88 if (getState().getIn(['accounts', id
], null) !== null) {
92 dispatch(fetchAccountRequest(id
));
94 api(getState
).get(`/api/v1/accounts/${id}`).then(response
=> {
95 dispatch(fetchAccountSuccess(response
.data
));
97 dispatch(fetchAccountFail(id
, error
));
102 export function fetchAccountTimeline(id
, replace
= false) {
103 return (dispatch
, getState
) => {
104 const ids
= getState().getIn(['timelines', 'accounts_timelines', id
, 'items'], Immutable
.List());
105 const newestId
= ids
.size
> 0 ? ids
.first() : null;
108 let skipLoading
= false;
110 if (newestId
!== null && !replace
) {
111 params
.since_id
= newestId
;
115 dispatch(fetchAccountTimelineRequest(id
, skipLoading
));
117 api(getState
).get(`/api/v1/accounts/${id}/statuses`, { params
}).then(response
=> {
118 dispatch(fetchAccountTimelineSuccess(id
, response
.data
, replace
, skipLoading
));
120 dispatch(fetchAccountTimelineFail(id
, error
, skipLoading
));
125 export function fetchAccountMediaTimeline(id
, replace
= false) {
126 return (dispatch
, getState
) => {
127 const ids
= getState().getIn(['timelines', 'accounts_media_timelines', id
, 'items'], Immutable
.List());
128 const newestId
= ids
.size
> 0 ? ids
.first() : null;
130 let params
= { only_media: 'true', limit: 12 };
131 let skipLoading
= false;
133 if (newestId
!== null && !replace
) {
134 params
.since_id
= newestId
;
138 dispatch(fetchAccountMediaTimelineRequest(id
, skipLoading
));
140 api(getState
).get(`/api/v1/accounts/${id}/statuses`, { params
}).then(response
=> {
141 dispatch(fetchAccountMediaTimelineSuccess(id
, response
.data
, replace
, skipLoading
));
143 dispatch(fetchAccountMediaTimelineFail(id
, error
, skipLoading
));
148 export function expandAccountTimeline(id
) {
149 return (dispatch
, getState
) => {
150 const lastId
= getState().getIn(['timelines', 'accounts_timelines', id
, 'items'], Immutable
.List()).last();
152 dispatch(expandAccountTimelineRequest(id
));
154 api(getState
).get(`/api/v1/accounts/${id}/statuses`, {
159 }).then(response
=> {
160 const next
= getLinks(response
).refs
.find(link
=> link
.rel
=== 'next');
161 dispatch(expandAccountTimelineSuccess(id
, response
.data
, next
));
163 dispatch(expandAccountTimelineFail(id
, error
));
168 export function expandAccountMediaTimeline(id
) {
169 return (dispatch
, getState
) => {
170 const lastId
= getState().getIn(['timelines', 'accounts_media_timelines', id
, 'items'], Immutable
.List()).last();
172 dispatch(expandAccountMediaTimelineRequest(id
));
174 api(getState
).get(`/api/v1/accounts/${id}/statuses`, {
180 }).then(response
=> {
181 const next
= getLinks(response
).refs
.find(link
=> link
.rel
=== 'next');
182 dispatch(expandAccountMediaTimelineSuccess(id
, response
.data
, next
));
184 dispatch(expandAccountMediaTimelineFail(id
, error
));
189 export function fetchAccountRequest(id
) {
191 type: ACCOUNT_FETCH_REQUEST
,
196 export function fetchAccountSuccess(account
) {
198 type: ACCOUNT_FETCH_SUCCESS
,
203 export function fetchAccountFail(id
, error
) {
205 type: ACCOUNT_FETCH_FAIL
,
212 export function followAccount(id
) {
213 return (dispatch
, getState
) => {
214 dispatch(followAccountRequest(id
));
216 api(getState
).post(`/api/v1/accounts/${id}/follow`).then(response
=> {
217 dispatch(followAccountSuccess(response
.data
));
219 dispatch(followAccountFail(error
));
224 export function unfollowAccount(id
) {
225 return (dispatch
, getState
) => {
226 dispatch(unfollowAccountRequest(id
));
228 api(getState
).post(`/api/v1/accounts/${id}/unfollow`).then(response
=> {
229 dispatch(unfollowAccountSuccess(response
.data
));
231 dispatch(unfollowAccountFail(error
));
236 export function followAccountRequest(id
) {
238 type: ACCOUNT_FOLLOW_REQUEST
,
243 export function followAccountSuccess(relationship
) {
245 type: ACCOUNT_FOLLOW_SUCCESS
,
250 export function followAccountFail(error
) {
252 type: ACCOUNT_FOLLOW_FAIL
,
257 export function unfollowAccountRequest(id
) {
259 type: ACCOUNT_UNFOLLOW_REQUEST
,
264 export function unfollowAccountSuccess(relationship
) {
266 type: ACCOUNT_UNFOLLOW_SUCCESS
,
271 export function unfollowAccountFail(error
) {
273 type: ACCOUNT_UNFOLLOW_FAIL
,
278 export function fetchAccountTimelineRequest(id
, skipLoading
) {
280 type: ACCOUNT_TIMELINE_FETCH_REQUEST
,
286 export function fetchAccountTimelineSuccess(id
, statuses
, replace
, skipLoading
) {
288 type: ACCOUNT_TIMELINE_FETCH_SUCCESS
,
296 export function fetchAccountTimelineFail(id
, error
, skipLoading
) {
298 type: ACCOUNT_TIMELINE_FETCH_FAIL
,
302 skipAlert: error
.response
.status
=== 404,
306 export function fetchAccountMediaTimelineRequest(id
, skipLoading
) {
308 type: ACCOUNT_MEDIA_TIMELINE_FETCH_REQUEST
,
314 export function fetchAccountMediaTimelineSuccess(id
, statuses
, replace
, skipLoading
) {
316 type: ACCOUNT_MEDIA_TIMELINE_FETCH_SUCCESS
,
324 export function fetchAccountMediaTimelineFail(id
, error
, skipLoading
) {
326 type: ACCOUNT_MEDIA_TIMELINE_FETCH_FAIL
,
330 skipAlert: error
.response
.status
=== 404,
334 export function expandAccountTimelineRequest(id
) {
336 type: ACCOUNT_TIMELINE_EXPAND_REQUEST
,
341 export function expandAccountTimelineSuccess(id
, statuses
, next
) {
343 type: ACCOUNT_TIMELINE_EXPAND_SUCCESS
,
350 export function expandAccountTimelineFail(id
, error
) {
352 type: ACCOUNT_TIMELINE_EXPAND_FAIL
,
358 export function expandAccountMediaTimelineRequest(id
) {
360 type: ACCOUNT_MEDIA_TIMELINE_EXPAND_REQUEST
,
365 export function expandAccountMediaTimelineSuccess(id
, statuses
, next
) {
367 type: ACCOUNT_MEDIA_TIMELINE_EXPAND_SUCCESS
,
374 export function expandAccountMediaTimelineFail(id
, error
) {
376 type: ACCOUNT_MEDIA_TIMELINE_EXPAND_FAIL
,
382 export function blockAccount(id
) {
383 return (dispatch
, getState
) => {
384 dispatch(blockAccountRequest(id
));
386 api(getState
).post(`/api/v1/accounts/${id}/block`).then(response
=> {
387 // Pass in entire statuses map so we can use it to filter stuff in different parts of the reducers
388 dispatch(blockAccountSuccess(response
.data
, getState().get('statuses')));
390 dispatch(blockAccountFail(id
, error
));
395 export function unblockAccount(id
) {
396 return (dispatch
, getState
) => {
397 dispatch(unblockAccountRequest(id
));
399 api(getState
).post(`/api/v1/accounts/${id}/unblock`).then(response
=> {
400 dispatch(unblockAccountSuccess(response
.data
));
402 dispatch(unblockAccountFail(id
, error
));
407 export function blockAccountRequest(id
) {
409 type: ACCOUNT_BLOCK_REQUEST
,
414 export function blockAccountSuccess(relationship
, statuses
) {
416 type: ACCOUNT_BLOCK_SUCCESS
,
422 export function blockAccountFail(error
) {
424 type: ACCOUNT_BLOCK_FAIL
,
429 export function unblockAccountRequest(id
) {
431 type: ACCOUNT_UNBLOCK_REQUEST
,
436 export function unblockAccountSuccess(relationship
) {
438 type: ACCOUNT_UNBLOCK_SUCCESS
,
443 export function unblockAccountFail(error
) {
445 type: ACCOUNT_UNBLOCK_FAIL
,
451 export function muteAccount(id
) {
452 return (dispatch
, getState
) => {
453 dispatch(muteAccountRequest(id
));
455 api(getState
).post(`/api/v1/accounts/${id}/mute`).then(response
=> {
456 // Pass in entire statuses map so we can use it to filter stuff in different parts of the reducers
457 dispatch(muteAccountSuccess(response
.data
, getState().get('statuses')));
459 dispatch(muteAccountFail(id
, error
));
464 export function unmuteAccount(id
) {
465 return (dispatch
, getState
) => {
466 dispatch(unmuteAccountRequest(id
));
468 api(getState
).post(`/api/v1/accounts/${id}/unmute`).then(response
=> {
469 dispatch(unmuteAccountSuccess(response
.data
));
471 dispatch(unmuteAccountFail(id
, error
));
476 export function muteAccountRequest(id
) {
478 type: ACCOUNT_MUTE_REQUEST
,
483 export function muteAccountSuccess(relationship
, statuses
) {
485 type: ACCOUNT_MUTE_SUCCESS
,
491 export function muteAccountFail(error
) {
493 type: ACCOUNT_MUTE_FAIL
,
498 export function unmuteAccountRequest(id
) {
500 type: ACCOUNT_UNMUTE_REQUEST
,
505 export function unmuteAccountSuccess(relationship
) {
507 type: ACCOUNT_UNMUTE_SUCCESS
,
512 export function unmuteAccountFail(error
) {
514 type: ACCOUNT_UNMUTE_FAIL
,
520 export function fetchFollowers(id
) {
521 return (dispatch
, getState
) => {
522 dispatch(fetchFollowersRequest(id
));
524 api(getState
).get(`/api/v1/accounts/${id}/followers`).then(response
=> {
525 const next
= getLinks(response
).refs
.find(link
=> link
.rel
=== 'next');
527 dispatch(fetchFollowersSuccess(id
, response
.data
, next
? next
.uri : null));
528 dispatch(fetchRelationships(response
.data
.map(item
=> item
.id
)));
530 dispatch(fetchFollowersFail(id
, error
));
535 export function fetchFollowersRequest(id
) {
537 type: FOLLOWERS_FETCH_REQUEST
,
542 export function fetchFollowersSuccess(id
, accounts
, next
) {
544 type: FOLLOWERS_FETCH_SUCCESS
,
551 export function fetchFollowersFail(id
, error
) {
553 type: FOLLOWERS_FETCH_FAIL
,
559 export function expandFollowers(id
) {
560 return (dispatch
, getState
) => {
561 const url
= getState().getIn(['user_lists', 'followers', id
, 'next']);
567 dispatch(expandFollowersRequest(id
));
569 api(getState
).get(url
).then(response
=> {
570 const next
= getLinks(response
).refs
.find(link
=> link
.rel
=== 'next');
572 dispatch(expandFollowersSuccess(id
, response
.data
, next
? next
.uri : null));
573 dispatch(fetchRelationships(response
.data
.map(item
=> item
.id
)));
575 dispatch(expandFollowersFail(id
, error
));
580 export function expandFollowersRequest(id
) {
582 type: FOLLOWERS_EXPAND_REQUEST
,
587 export function expandFollowersSuccess(id
, accounts
, next
) {
589 type: FOLLOWERS_EXPAND_SUCCESS
,
596 export function expandFollowersFail(id
, error
) {
598 type: FOLLOWERS_EXPAND_FAIL
,
604 export function fetchFollowing(id
) {
605 return (dispatch
, getState
) => {
606 dispatch(fetchFollowingRequest(id
));
608 api(getState
).get(`/api/v1/accounts/${id}/following`).then(response
=> {
609 const next
= getLinks(response
).refs
.find(link
=> link
.rel
=== 'next');
611 dispatch(fetchFollowingSuccess(id
, response
.data
, next
? next
.uri : null));
612 dispatch(fetchRelationships(response
.data
.map(item
=> item
.id
)));
614 dispatch(fetchFollowingFail(id
, error
));
619 export function fetchFollowingRequest(id
) {
621 type: FOLLOWING_FETCH_REQUEST
,
626 export function fetchFollowingSuccess(id
, accounts
, next
) {
628 type: FOLLOWING_FETCH_SUCCESS
,
635 export function fetchFollowingFail(id
, error
) {
637 type: FOLLOWING_FETCH_FAIL
,
643 export function expandFollowing(id
) {
644 return (dispatch
, getState
) => {
645 const url
= getState().getIn(['user_lists', 'following', id
, 'next']);
651 dispatch(expandFollowingRequest(id
));
653 api(getState
).get(url
).then(response
=> {
654 const next
= getLinks(response
).refs
.find(link
=> link
.rel
=== 'next');
656 dispatch(expandFollowingSuccess(id
, response
.data
, next
? next
.uri : null));
657 dispatch(fetchRelationships(response
.data
.map(item
=> item
.id
)));
659 dispatch(expandFollowingFail(id
, error
));
664 export function expandFollowingRequest(id
) {
666 type: FOLLOWING_EXPAND_REQUEST
,
671 export function expandFollowingSuccess(id
, accounts
, next
) {
673 type: FOLLOWING_EXPAND_SUCCESS
,
680 export function expandFollowingFail(id
, error
) {
682 type: FOLLOWING_EXPAND_FAIL
,
688 export function fetchRelationships(accountIds
) {
689 return (dispatch
, getState
) => {
690 const loadedRelationships
= getState().get('relationships');
691 const newAccountIds
= accountIds
.filter(id
=> loadedRelationships
.get(id
, null) === null);
693 if (newAccountIds
.length
=== 0) {
697 dispatch(fetchRelationshipsRequest(newAccountIds
));
699 api(getState
).get(`/api/v1/accounts/relationships?${newAccountIds.map(id => `id[]=${id}`).join('&')}`).then(response => {
700 dispatch(fetchRelationshipsSuccess(response.data));
702 dispatch(fetchRelationshipsFail(error));
707 export function fetchRelationshipsRequest(ids) {
709 type: RELATIONSHIPS_FETCH_REQUEST,
715 export function fetchRelationshipsSuccess(relationships) {
717 type: RELATIONSHIPS_FETCH_SUCCESS,
723 export function fetchRelationshipsFail(error) {
725 type: RELATIONSHIPS_FETCH_FAIL,
731 export function fetchFollowRequests() {
732 return (dispatch, getState) => {
733 dispatch(fetchFollowRequestsRequest());
735 api(getState).get('/api/v1/follow_requests').then(response => {
736 const next = getLinks(response).refs.find(link => link.rel === 'next');
737 dispatch(fetchFollowRequestsSuccess(response.data, next ? next.uri : null));
738 }).catch(error => dispatch(fetchFollowRequestsFail(error)));
742 export function fetchFollowRequestsRequest() {
744 type: FOLLOW_REQUESTS_FETCH_REQUEST,
748 export function fetchFollowRequestsSuccess(accounts, next) {
750 type: FOLLOW_REQUESTS_FETCH_SUCCESS,
756 export function fetchFollowRequestsFail(error) {
758 type: FOLLOW_REQUESTS_FETCH_FAIL,
763 export function expandFollowRequests() {
764 return (dispatch, getState) => {
765 const url = getState().getIn(['user_lists', 'follow_requests', 'next']);
771 dispatch(expandFollowRequestsRequest());
773 api(getState).get(url).then(response => {
774 const next = getLinks(response).refs.find(link => link.rel === 'next');
775 dispatch(expandFollowRequestsSuccess(response.data, next ? next.uri : null));
776 }).catch(error => dispatch(expandFollowRequestsFail(error)));
780 export function expandFollowRequestsRequest() {
782 type: FOLLOW_REQUESTS_EXPAND_REQUEST,
786 export function expandFollowRequestsSuccess(accounts, next) {
788 type: FOLLOW_REQUESTS_EXPAND_SUCCESS,
794 export function expandFollowRequestsFail(error) {
796 type: FOLLOW_REQUESTS_EXPAND_FAIL,
801 export function authorizeFollowRequest(id) {
802 return (dispatch, getState) => {
803 dispatch(authorizeFollowRequestRequest(id));
806 .post(`/api/v1
/follow_requests/${id}
/authorize
`)
807 .then(response => dispatch(authorizeFollowRequestSuccess(id)))
808 .catch(error => dispatch(authorizeFollowRequestFail(id, error)));
812 export function authorizeFollowRequestRequest(id) {
814 type: FOLLOW_REQUEST_AUTHORIZE_REQUEST,
819 export function authorizeFollowRequestSuccess(id) {
821 type: FOLLOW_REQUEST_AUTHORIZE_SUCCESS,
826 export function authorizeFollowRequestFail(id, error) {
828 type: FOLLOW_REQUEST_AUTHORIZE_FAIL,
835 export function rejectFollowRequest(id) {
836 return (dispatch, getState) => {
837 dispatch(rejectFollowRequestRequest(id));
840 .post(`/api/v1
/follow_requests/${id}
/reject
`)
841 .then(response => dispatch(rejectFollowRequestSuccess(id)))
842 .catch(error => dispatch(rejectFollowRequestFail(id, error)));
846 export function rejectFollowRequestRequest(id) {
848 type: FOLLOW_REQUEST_REJECT_REQUEST,
853 export function rejectFollowRequestSuccess(id) {
855 type: FOLLOW_REQUEST_REJECT_SUCCESS,
860 export function rejectFollowRequestFail(id, error) {
862 type: FOLLOW_REQUEST_REJECT_FAIL,