您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

actions.js 1.3KB

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