Search.../

rejectJoinRequests( )

Rejects requests to join a group.

Description


Note: This function is only relevant for private groups.

The rejectJoinRequests() function returns a Promise that resolves when the site member's request to join a group is rejected. Only site admins or group admins can reject site member requests to join the group, unless the group setting, membersCanApprove is set to true.

Note: If the suppressAuth option is set to true, all permissions are overwritten, and all site members (including non-group members) can reject site member requests to join a group.

Syntax

function rejectJoinRequests(groupId: string, rejections: Array<Rejection>, [options: Options]): Promise<Array<JoinRequest>>

rejectJoinRequests Parameters

NAME
TYPE
DESCRIPTION
groupId
string

ID of the group requested to join.

rejections
Array<Rejection>

Rejection data.

options
Optional
Options

Authorization options.

Returns

Return Type:

Promise<Array<JoinRequest>>
NAME
TYPE
DESCRIPTION
memberId
string

Site member ID of the requester.

_createdDate
Date

Date the site member requested to join the group.

status
string

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

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

Reason the request to join a group was rejected.

Was this helpful?

Reject a request to join a group

Copy Code
1import { joinRequests } from 'wix-groups-backend';
2
3// Sample groupId value:
4// "6z2334b13bb4b44569a7cdf292j227"
5//
6// Sample rejections value:
7// [
8// {
9// memberId: '77490611-53bb-4b47-a7cc-ca9a1335133b',
10// reason: 'This group is for college students only.'
11// }
12// ]
13
14export function myRejectJoinRequestsFunction(groupId, rejections) {
15 return joinRequests.rejectJoinRequests(groupId, rejections)
16 .then((rejectedJoinRequests) => {
17 console.log('Rejected ', rejectedJoinRequests);
18 })
19 .catch((error) => {
20 console.error(error);
21 });
22}
23
24/* Promise resolves to:
25 * [
26 * {
27 * "memberId": "77490611-53bb-4b47-a7cc-ca9a1335133b"
28 * "_createdDate": "Mon July 12 2020 13:15:10 GMT+0300"
29 * "status": "REJECTED"
30 * "rejectionReason": "This group is for college students only."
31 * }
32 * ]
33 */