// @flow import { SET_CALENDAR_AUTHORIZATION, SET_CALENDAR_EVENTS, ADD_KNOWN_DOMAIN, REFRESH_CALENDAR } from './actionTypes'; /** * Sends an action to add a new known domain if not present yet. * * @param {string} knownDomain - The new domain. * @returns {{ * type: ADD_KNOWN_DOMAIN, * knownDomain: string * }} */ export function addKnownDomain(knownDomain: string) { return { type: ADD_KNOWN_DOMAIN, knownDomain }; } /** * Sends an action to refresh the entry list (fetches new data). * * @param {boolean|undefined} forcePermission - Whether to force to re-ask for * the permission or not. * @returns {{ * type: REFRESH_CALENDAR, * forcePermission: boolean * }} */ export function refreshCalendar(forcePermission: boolean = false) { return { type: REFRESH_CALENDAR, forcePermission }; } /** * Sends an action to signal that a calendar access has been requested. For more * info, see {@link SET_CALENDAR_AUTHORIZATION}. * * @param {string | undefined} authorization - The result of the last calendar * authorization request. * @returns {{ * type: SET_CALENDAR_AUTHORIZATION, * authorization: ?string * }} */ export function setCalendarAuthorization(authorization: ?string) { return { type: SET_CALENDAR_AUTHORIZATION, authorization }; } /** * Sends an action to update the current calendar list in redux. * * @param {Array} events - The new list. * @returns {{ * type: SET_CALENDAR_EVENTS, * events: Array * }} */ export function setCalendarEvents(events: Array) { return { type: SET_CALENDAR_EVENTS, events }; }