You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.0 KiB

  1. import api from '../api';
  2. export const PINNED_STATUSES_FETCH_REQUEST = 'PINNED_STATUSES_FETCH_REQUEST';
  3. export const PINNED_STATUSES_FETCH_SUCCESS = 'PINNED_STATUSES_FETCH_SUCCESS';
  4. export const PINNED_STATUSES_FETCH_FAIL = 'PINNED_STATUSES_FETCH_FAIL';
  5. export function fetchPinnedStatuses() {
  6. return (dispatch, getState) => {
  7. dispatch(fetchPinnedStatusesRequest());
  8. const accountId = getState().getIn(['meta', 'me']);
  9. api(getState).get(`/api/v1/accounts/${accountId}/statuses`, { params: { pinned: true } }).then(response => {
  10. dispatch(fetchPinnedStatusesSuccess(response.data, null));
  11. }).catch(error => {
  12. dispatch(fetchPinnedStatusesFail(error));
  13. });
  14. };
  15. };
  16. export function fetchPinnedStatusesRequest() {
  17. return {
  18. type: PINNED_STATUSES_FETCH_REQUEST,
  19. };
  20. };
  21. export function fetchPinnedStatusesSuccess(statuses, next) {
  22. return {
  23. type: PINNED_STATUSES_FETCH_SUCCESS,
  24. statuses,
  25. next,
  26. };
  27. };
  28. export function fetchPinnedStatusesFail(error) {
  29. return {
  30. type: PINNED_STATUSES_FETCH_FAIL,
  31. error,
  32. };
  33. };