Build a custom flow for managing organization membership requests
This guide will demonstrate how to use the Clerk API to build a custom flow for managing organization membership requests.
The following example uses the useOrganization()
hook to get membershipRequests
, which is a list of the active organization's membership requests.
membershipRequests
is an object with data
that contains an array of OrganizationMembershipRequest
objects.
Each OrganizationMembershipRequest
object has an accept()
and reject()
method to accept or reject the membership request, respectively.
This example is written for Next.js App Router but can be adapted for any React meta framework, such as Remix.
The following example:
- Calls the
getMembershipRequests()
method to retrieve the list of membership requests for the active organization. This method returnsdata
, which is an array ofOrganizationMembershipRequest
objects. - Maps over the
data
array to display the membership requests in a table. - Provides an "Accept" and "Reject" button for each request that calls the
accept()
andreject()
methods, respectively.
Use the tabs to view the code necessary for the index.html
and main.js
files.
Feedback
Last updated on