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