File size: 1,541 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import {
	CONNECTED_APPLICATION_DELETE,
	CONNECTED_APPLICATION_DELETE_SUCCESS,
	CONNECTED_APPLICATIONS_RECEIVE,
	CONNECTED_APPLICATIONS_REQUEST,
} from 'calypso/state/action-types';

import 'calypso/state/data-layer/wpcom/me/connected-applications';
import 'calypso/state/data-layer/wpcom/me/connected-applications/delete';
import 'calypso/state/connected-applications/init';

/**
 * Returns an action object to signal the request of the user's connected applications.
 * @returns {Object} Action object
 */
export const requestConnectedApplications = () => ( {
	type: CONNECTED_APPLICATIONS_REQUEST,
} );

/**
 * Returns an action object to signal the receiving of connected applications.
 * @param  {Array}  apps Array containing the connected applications of the current user.
 * @returns {Object} Action object.
 */
export const receiveConnectedApplications = ( apps ) => ( {
	type: CONNECTED_APPLICATIONS_RECEIVE,
	apps,
} );

/**
 * Returns an action object to signal the deletion of a connected application.
 * @param  {string} appId ID of the connected application.
 * @returns {Object} Action object.
 */
export const deleteConnectedApplication = ( appId ) => ( {
	type: CONNECTED_APPLICATION_DELETE,
	appId,
} );

/**
 * Returns an action object to signal the successful deletion of a connected application.
 * @param  {string} appId ID of the connected application.
 * @returns {Object} Action object.
 */
export const deleteConnectedApplicationSuccess = ( appId ) => ( {
	type: CONNECTED_APPLICATION_DELETE_SUCCESS,
	appId,
} );