about summary refs log tree commit diff
path: root/app/assets/javascripts/components/actions/accounts.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/components/actions/accounts.jsx')
-rw-r--r--app/assets/javascripts/components/actions/accounts.jsx39
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
+  };
+};