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