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.

actions.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // @flow
  2. import {
  3. NEW_CALENDAR_ENTRY_LIST,
  4. NEW_KNOWN_DOMAIN,
  5. REFRESH_CALENDAR_ENTRY_LIST
  6. } from './actionTypes';
  7. /**
  8. * Sends an action to add a new known domain if not present yet.
  9. *
  10. * @param {string} domainName - The new domain.
  11. * @returns {{
  12. * type: NEW_KNOWN_DOMAIN,
  13. * domainName: string
  14. * }}
  15. */
  16. export function maybeAddNewKnownDomain(domainName: string) {
  17. return {
  18. type: NEW_KNOWN_DOMAIN,
  19. domainName
  20. };
  21. }
  22. /**
  23. * Sends an action to refresh the entry list (fetches new data).
  24. *
  25. * @returns {{
  26. * type: REFRESH_CALENDAR_ENTRY_LIST
  27. * }}
  28. */
  29. export function refreshCalendarEntryList() {
  30. return {
  31. type: REFRESH_CALENDAR_ENTRY_LIST
  32. };
  33. }
  34. /**
  35. * Sends an action to update the current calendar list in redux.
  36. *
  37. * @param {Array<Object>} events - The new list.
  38. * @returns {{
  39. * type: NEW_CALENDAR_ENTRY_LIST,
  40. * events: Array<Object>
  41. * }}
  42. */
  43. export function updateCalendarEntryList(events: Array<Object>) {
  44. return {
  45. type: NEW_CALENDAR_ENTRY_LIST,
  46. events
  47. };
  48. }