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.any.ts 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import {
  2. REFRESH_CALENDAR,
  3. SET_CALENDAR_AUTHORIZATION,
  4. SET_CALENDAR_EVENTS
  5. } from './actionTypes';
  6. /**
  7. * Sends an action to refresh the entry list (fetches new data).
  8. *
  9. * @param {boolean} forcePermission - Whether to force to re-ask for
  10. * the permission or not.
  11. * @param {boolean} isInteractive - If true this refresh was caused by
  12. * direct user interaction, false otherwise.
  13. * @returns {{
  14. * type: REFRESH_CALENDAR,
  15. * forcePermission: boolean,
  16. * isInteractive: boolean
  17. * }}
  18. */
  19. export function refreshCalendar(forcePermission = false, isInteractive = true) {
  20. return {
  21. type: REFRESH_CALENDAR,
  22. forcePermission,
  23. isInteractive
  24. };
  25. }
  26. /**
  27. * Sends an action to signal that a calendar access has been requested. For more
  28. * info, see {@link SET_CALENDAR_AUTHORIZATION}.
  29. *
  30. * @param {string | undefined} authorization - The result of the last calendar
  31. * authorization request.
  32. * @returns {{
  33. * type: SET_CALENDAR_AUTHORIZATION,
  34. * authorization: ?string
  35. * }}
  36. */
  37. export function setCalendarAuthorization(authorization?: string) {
  38. return {
  39. type: SET_CALENDAR_AUTHORIZATION,
  40. authorization
  41. };
  42. }
  43. /**
  44. * Sends an action to update the current calendar list in redux.
  45. *
  46. * @param {Array<Object>} events - The new list.
  47. * @returns {{
  48. * type: SET_CALENDAR_EVENTS,
  49. * events: Array<Object>
  50. * }}
  51. */
  52. export function setCalendarEvents(events: Array<Object>) {
  53. return {
  54. type: SET_CALENDAR_EVENTS,
  55. events
  56. };
  57. }