about summary refs log tree commit diff
path: root/app/assets/javascripts/components/actions/statuses.jsx
blob: fece257d581826c04896092ba053416a354f3ee5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import fetch from 'isomorphic-fetch'

export const SET_TIMELINE = 'SET_TIMELINE';
export const ADD_STATUS   = 'ADD_STATUS';
export const PUBLISH      = 'PUBLISH';

export function setTimeline(timeline, statuses) {
  return {
    type: SET_TIMELINE,
    timeline: timeline,
    statuses: statuses
  };
}

export function addStatus(timeline, status) {
  return {
    type: ADD_STATUS,
    timeline: timeline,
    status: status
  };
}

export function publish(text, in_reply_to_id) {
  return function (dispatch) {
    return fetch('/api/statuses', {
      method: 'POST'
    }).then(function (response) {
      return response.json();
    }).then(function (json) {
      console.log(json);
    });
  };
}