From 0967961de758b375ca61df1ba9b448aaa2e3c1f8 Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Sun, 18 Sep 2016 18:18:46 +0200
Subject: Improve how account detailed view looks, load account's statuses

---
 .../javascripts/components/actions/accounts.jsx    | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)

(limited to 'app/assets/javascripts/components/actions/accounts.jsx')

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
+  };
+};
-- 
cgit 

