2016-08-25 17:52:55 +00:00
|
|
|
import fetch from 'isomorphic-fetch'
|
|
|
|
|
2016-08-24 15:56:44 +00:00
|
|
|
export const SET_TIMELINE = 'SET_TIMELINE';
|
|
|
|
export const ADD_STATUS = 'ADD_STATUS';
|
2016-08-25 17:52:55 +00:00
|
|
|
export const PUBLISH = 'PUBLISH';
|
2016-08-24 15:56:44 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
};
|
|
|
|
}
|
2016-08-25 17:52:55 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|