jiti-meet/react/features/calendar-sync/actions.js

59 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-02-08 18:50:19 +00:00
// @flow
2018-04-16 02:04:57 +00:00
2018-02-14 16:50:48 +00:00
import {
REFRESH_CALENDAR,
2018-04-16 02:04:57 +00:00
SET_CALENDAR_AUTHORIZATION,
SET_CALENDAR_EVENTS
2018-02-14 16:50:48 +00:00
} from './actionTypes';
2018-02-08 18:50:19 +00:00
/**
2018-04-16 02:04:57 +00:00
* Sends an action to refresh the entry list (fetches new data).
2018-02-08 18:50:19 +00:00
*
2018-04-16 02:04:57 +00:00
* @param {boolean|undefined} forcePermission - Whether to force to re-ask for
* the permission or not.
2018-02-08 18:50:19 +00:00
* @returns {{
2018-04-16 02:04:57 +00:00
* type: REFRESH_CALENDAR,
* forcePermission: boolean
2018-02-08 18:50:19 +00:00
* }}
*/
2018-04-16 02:04:57 +00:00
export function refreshCalendar(forcePermission: boolean = false) {
2018-02-08 18:50:19 +00:00
return {
2018-04-16 02:04:57 +00:00
type: REFRESH_CALENDAR,
forcePermission
2018-02-08 18:50:19 +00:00
};
}
2018-02-14 16:21:52 +00:00
/**
2018-04-16 02:04:57 +00:00
* Sends an action to signal that a calendar access has been requested. For more
* info, see {@link SET_CALENDAR_AUTHORIZATION}.
2018-02-14 16:21:52 +00:00
*
2018-04-16 02:04:57 +00:00
* @param {string | undefined} authorization - The result of the last calendar
* authorization request.
2018-02-14 16:21:52 +00:00
* @returns {{
2018-04-16 02:04:57 +00:00
* type: SET_CALENDAR_AUTHORIZATION,
* authorization: ?string
2018-02-14 16:21:52 +00:00
* }}
*/
2018-04-16 02:04:57 +00:00
export function setCalendarAuthorization(authorization: ?string) {
2018-02-14 16:21:52 +00:00
return {
2018-04-16 02:04:57 +00:00
type: SET_CALENDAR_AUTHORIZATION,
authorization
2018-02-14 16:50:48 +00:00
};
}
/**
* Sends an action to update the current calendar list in redux.
*
* @param {Array<Object>} events - The new list.
* @returns {{
2018-04-16 02:04:57 +00:00
* type: SET_CALENDAR_EVENTS,
* events: Array<Object>
2018-02-14 16:50:48 +00:00
* }}
*/
2018-04-16 02:04:57 +00:00
export function setCalendarEvents(events: Array<Object>) {
2018-02-14 16:50:48 +00:00
return {
2018-04-16 02:04:57 +00:00
type: SET_CALENDAR_EVENTS,
2018-02-14 16:50:48 +00:00
events
2018-02-14 16:21:52 +00:00
};
}