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
992 B

  1. import api from '../api';
  2. export const CUSTOM_EMOJIS_FETCH_REQUEST = 'CUSTOM_EMOJIS_FETCH_REQUEST';
  3. export const CUSTOM_EMOJIS_FETCH_SUCCESS = 'CUSTOM_EMOJIS_FETCH_SUCCESS';
  4. export const CUSTOM_EMOJIS_FETCH_FAIL = 'CUSTOM_EMOJIS_FETCH_FAIL';
  5. export function fetchCustomEmojis() {
  6. return (dispatch, getState) => {
  7. dispatch(fetchCustomEmojisRequest());
  8. api(getState).get('/api/v1/custom_emojis').then(response => {
  9. dispatch(fetchCustomEmojisSuccess(response.data));
  10. }).catch(error => {
  11. dispatch(fetchCustomEmojisFail(error));
  12. });
  13. };
  14. };
  15. export function fetchCustomEmojisRequest() {
  16. return {
  17. type: CUSTOM_EMOJIS_FETCH_REQUEST,
  18. skipLoading: true,
  19. };
  20. };
  21. export function fetchCustomEmojisSuccess(custom_emojis) {
  22. return {
  23. type: CUSTOM_EMOJIS_FETCH_SUCCESS,
  24. custom_emojis,
  25. skipLoading: true,
  26. };
  27. };
  28. export function fetchCustomEmojisFail(error) {
  29. return {
  30. type: CUSTOM_EMOJIS_FETCH_FAIL,
  31. error,
  32. skipLoading: true,
  33. };
  34. };