|
|
|
@ -107,10 +107,11 @@ export function fetchAccountFail(id, error) { |
|
|
|
|
|
|
|
|
|
export function followAccount(id, reblogs = true) { |
|
|
|
|
return (dispatch, getState) => { |
|
|
|
|
const alreadyFollowing = getState().getIn(['relationships', id, 'following']); |
|
|
|
|
dispatch(followAccountRequest(id)); |
|
|
|
|
|
|
|
|
|
api(getState).post(`/api/v1/accounts/${id}/follow`, { reblogs }).then(response => { |
|
|
|
|
dispatch(followAccountSuccess(response.data)); |
|
|
|
|
dispatch(followAccountSuccess(response.data, alreadyFollowing)); |
|
|
|
|
}).catch(error => { |
|
|
|
|
dispatch(followAccountFail(error)); |
|
|
|
|
}); |
|
|
|
@ -136,10 +137,11 @@ export function followAccountRequest(id) { |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export function followAccountSuccess(relationship) { |
|
|
|
|
export function followAccountSuccess(relationship, alreadyFollowing) { |
|
|
|
|
return { |
|
|
|
|
type: ACCOUNT_FOLLOW_SUCCESS, |
|
|
|
|
relationship, |
|
|
|
|
alreadyFollowing, |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|