Search.../

rejectCreateRequests( )

Rejects requests to create a group.

Description


Note: This function is only relevant if admin approval is required for creating a group, or if the function's suppressAuth option is set to true.

The rejectCreateRequests() function returns a Promise that resolves when the site member's request to create a group is rejected. Only site admins can reject requests to create a group.

Note: If the suppressAuth option is set to true, all permissions are overwritten, and all site members can reject requests to create a group.

Syntax

function rejectCreateRequests(rejections: Array<RejectCreateRequest>, [options: Options]): Promise<Array<CreateRequest>>

rejectCreateRequests Parameters

NAME
TYPE
DESCRIPTION
rejections
Array<RejectCreateRequest>

Rejection data.

options
Optional
Options

Authorization options.

Returns

Return Type:

Promise<Array<CreateRequest>>
NAME
TYPE
DESCRIPTION
_id
string

ID of the request to create a group. Same as group ID.

status
string

Status of the request to create a group. One of:

  • "PENDING"
  • "APPROVED"
  • "REJECTED"
rejectionReason
string

Reason the request to create a group was rejected.

group
Group

Group requested to create.

Was this helpful?

Reject a request to create a group

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { createRequests } from 'wix-groups-backend';
3
4// Sample rejections value:
5// [
6// {
7// createRequestId: '77490611-53bb-4b47-a7cc-ca9a1335133b',
8// reason: 'This group is for teachers only'
9// }
10// ]
11//
12// Sample options value:
13// {
14// suppressAuth: true
15// }
16//
17
18export const myRejectCreateRequestsFunction = webMethod(Permissions.Anyone, (rejections, options) => {
19 return createRequests.rejectCreateRequests(rejections, options)
20 .then((rejectedCreateRequests) => {
21 return rejectedCreateRequests;
22 })
23 .catch((error) => {
24 console.error(error);
25 });
26});
27
28/* Promise resolves to:
29 * [
30 * {
31 * "_id": "77490611-53bb-4b47-a7cc-ca9a1335133b",
32 * "status": "REJECTED"
33 * "rejectionReason": "This group is for teachers only."
34 * "group": {
35 * "_id": "77490611-53bb-4b47-a7cc-ca9a1335133b"
36 * "name": "My Group Request 5"
37 * "slug": "my-group-request-5"
38 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."
39 * "privacyStatus": "PRIVATE"
40 * "coverImage": {
41 * "imageUrl": "wix:image://v1/jb9074e348009011fa9f2dzj0jn~mv2.jpg/nutmeg.jpg#originWidth=800&originHeight=720",
42 * "position": {
43 * "x": 66,
44 * "y": 10
45 * }
46 * }
47 * "memberTitle": "Co-workers"
48 * "memberCount": 1
49 * "settings": {
50 * "groupUpdatePostEnabled": true
51 * "membersCanApprove": false
52 * "membersCanInvite": true
53 * "showMemberList": true
54 * "welcomeMemberPostEnabled": true
55 * }
56 * "lastActivityDate": "Sun Sep 26 2021 08:23:23 GMT+0300"
57 * "_createdDate": "Sun Sep 26 2021 08:23:23 GMT+0300"
58 * "_updatedDate": "Sun Sep 26 2021 08:23:23 GMT+0300"
59 * "owner": "9ne8e9e1-d050-4c86-9684-e7f231600a34"
60 * }
61 * }
62 * ]
63 */