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.

40 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. import { me } from '../initial_state';
  6. export function fetchPinnedStatuses() {
  7. return (dispatch, getState) => {
  8. dispatch(fetchPinnedStatusesRequest());
  9. api(getState).get(`/api/v1/accounts/${me}/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. };