diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-09-18 18:18:46 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-09-18 18:18:46 +0200 |
commit | 0967961de758b375ca61df1ba9b448aaa2e3c1f8 (patch) | |
tree | 5935732cf384f05b35d30c16814b481d9012661b /app/assets/javascripts/components/actions | |
parent | dafcb021534d2a19ff5d4c1f9bedafb52a2ce77f (diff) |
Improve how account detailed view looks, load account's statuses
Diffstat (limited to 'app/assets/javascripts/components/actions')
-rw-r--r-- | app/assets/javascripts/components/actions/accounts.jsx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/app/assets/javascripts/components/actions/accounts.jsx b/app/assets/javascripts/components/actions/accounts.jsx index da6c261f2..aedc08a1d 100644 --- a/app/assets/javascripts/components/actions/accounts.jsx +++ b/app/assets/javascripts/components/actions/accounts.jsx @@ -14,6 +14,10 @@ export const ACCOUNT_UNFOLLOW_REQUEST = 'ACCOUNT_UNFOLLOW_REQUEST'; export const ACCOUNT_UNFOLLOW_SUCCESS = 'ACCOUNT_UNFOLLOW_SUCCESS'; export const ACCOUNT_UNFOLLOW_FAIL = 'ACCOUNT_UNFOLLOW_FAIL'; +export const ACCOUNT_TIMELINE_FETCH_REQUEST = 'ACCOUNT_TIMELINE_FETCH_REQUEST'; +export const ACCOUNT_TIMELINE_FETCH_SUCCESS = 'ACCOUNT_TIMELINE_FETCH_SUCCESS'; +export const ACCOUNT_TIMELINE_FETCH_FAIL = 'ACCOUNT_TIMELINE_FETCH_FAIL'; + export function setAccountSelf(account) { return { type: ACCOUNT_SET_SELF, @@ -33,6 +37,18 @@ export function fetchAccount(id) { }; }; +export function fetchAccountTimeline(id) { + return (dispatch, getState) => { + dispatch(fetchAccountTimelineRequest(id)); + + api(getState).get(`/api/accounts/${id}/statuses`).then(response => { + dispatch(fetchAccountTimelineSuccess(id, response.data)); + }).catch(error => { + dispatch(fetchAccountTimelineFail(id, error)); + }); + }; +}; + export function fetchAccountRequest(id) { return { type: ACCOUNT_FETCH_REQUEST, @@ -120,3 +136,26 @@ export function unfollowAccountFail(error) { error: error }; }; + +export function fetchAccountTimelineRequest(id) { + return { + type: ACCOUNT_TIMELINE_FETCH_REQUEST, + id: id + }; +}; + +export function fetchAccountTimelineSuccess(id, statuses) { + return { + type: ACCOUNT_TIMELINE_FETCH_SUCCESS, + id: id, + statuses: statuses + }; +}; + +export function fetchAccountTimelineFail(id, error) { + return { + type: ACCOUNT_TIMELINE_FETCH_FAIL, + id: id, + error: error + }; +}; |