Approves requests to join a group.
Note: This function is only relevant for private groups.
The approveJoinRequests()
function returns a Promise that resolves when a site member's request to join a group is approved.
Only site admins and group admins can approve site member requests to join a 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 approve site member requests to join a group.
function approveJoinRequests(
identifiers: Identifiers,
options: Options,
): Promise<Array<JoinRequest>>;
Group ID and member IDs.
Authorization options.
import { Permissions, webMethod } from "wix-web-module";
import { joinRequests } from "wix-groups-backend";
// Sample identifiers value:
// {
// groupId: '77490611-53bb-4b47-a7cc-ca9a1335133b',
// memberIds: ['124cd3db-e9be-4980-93c1-a6d767a11099', '2f48e9e1-d050-4c86-9684-e7f231600f29', '772cd3db-e9be-560-93c1-a6d767a11670']
// }
//
// Sample options value:
// {
// suppressAuth: true
// }
export const myApproveJoinRequestsFunction = webMethod(
Permissions.Anyone,
(identifiers, options) => {
return joinRequests
.approveJoinRequests(identifiers, options)
.then((approvedJoinRequests) => {
return approvedJoinRequests;
})
.catch((error) => {
console.error(error);
});
},
);
/* Promise resolves to:
* [
* {
* "memberId": "124cd3db-e9be-4980-93c1-a6d767a11099"
* "_createdDate": "Fri Oct 24 2021 22:45:50 GMT+0300"
* "status": "APPROVED"
* },
* {
* "memberId": "2f48e9e1-d050-4c86-9684-e7f231600f29"
* "_createdDate": "Wed May 14 2021 10:05:20 GMT+0300"
* "status": "APPROVED"
* },
* {
* "memberId": "772cd3db-e9be-560-93c1-a6d767a11670"
* "_createdDate": "Sun July 11 2020 03:25:30 GMT+0300"
* "status": "APPROVED"
* }
* ]
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.